Click to See Complete Forum and Search --> : How Do I Add A Border To My Table With CSS?


duderdude2
12-22-2004, 01:48 AM
How do I add a border to the table on this page:
http://www.gamexplain.com/test3.shtml

What I want is a border that lines the left and right sides of each cell, but not the top or bottom. I'm pretty sure I've read that this can be done, but I'm not sure how.

Here's a picture of what I want it to look like:
http://www.gamexplain.com/tablesample.jpg

Thanks!

Fang
12-22-2004, 06:54 AM
table {border:1px solid #000;}
or
<table style="border:1px solid #000; width:289px;" cellpadding="0" cellspacing="0" summary="">

See this thread (http://www.webdeveloper.com/forum/showthread.php?s=&threadid=52022)

emonster55
12-22-2004, 09:41 AM
What you need to do is put the following in your .css page

.leftandrightborder {
border-left: 1px solid black;
border-right: 1px solid black;
}

Then put this in the cell tag (<td>) that you want to have the style

it looks like this:

<td class="leftandrightborder"></td>

if you want your table to have the left/right border then put the class="leftandrightborder" in the table tag (<table>) that you want to change.

Fangs way (above) would not let you change it in your .css page but in your .html page

Hope this helps.

Ed

duderdude2
12-22-2004, 03:44 PM
Originally posted by Fang
table {border:1px solid #000;}
or
<table style="border:1px solid #000; width:289px;" cellpadding="0" cellspacing="0" summary="">

See this thread (http://www.webdeveloper.com/forum/showthread.php?s=&threadid=52022)

This worked great. Just one more thing, can I change the border's color?

Thanks!

NogDog
12-22-2004, 03:48 PM
Change the "#000" to any desired hex value ("#369" is equivalent to "#336699" and either format may be used) or use one of the CSS color keywords (http://www.w3.org/TR/CSS21/syndata.html#color-units).

duderdude2
12-22-2004, 03:55 PM
Originally posted by NogDog
Change the "#000" to any desired hex value ("#369" is equivalent to "#336699" and either format may be used) or use one of the CSS color keywords (http://www.w3.org/TR/CSS21/syndata.html#color-units).

Ok, great, that's kind of what I thought, the three digits just threw me off.

Thanks very much.