PDA

View Full Version : Css table border problem


Grant Palin
02-01-2003, 04:33 AM
I'm trying to convert my table borders to to use CSS instead of the border attribute. I put the following code into my page, for the topmost table, and the border around the table itself looks right, but the lines between the table cells are still a gray color. How can I fix this using CSS?


Here's the table CSS
table.stats {
border-width: 2px;
border-style: solid;
border-color: #000000;
}

And here's the table
<table width="100%" cellspacing="0" class="stats" border="1">
<tr>
<td width="10%">HP: 4</td>
<td width="10%">ATT: 6</td>
<td width="10%">DEF: 1</td>
<td width="15%">DAM: 1-2</td>
<td width="18%">SP: Fast</td>
<td width="7%">-</td>
<td width="15%">-</td>
<td width="15%">COST:50<img src="gold.gif" width="35" height="23" alt="Gold" /></td>
</tr>
<tr>
<td colspan="8"><b><u>Rogue</u>.</b> Their woeful defense and damage rating means Rogues aren't worth spit. They are often found guarding treasure, so they're worth fighting- they're so easy to beat. Enemies can't retaliate to a Rogue's attacks.</td>
</tr>
</table>


my page (http://www.freewebz.com/hommworld/HOMM/neutral_creatures.html)

Remember, it's the topmost table. The right table in the top table, that is (the one with the black border).

Thanks for any help.

meow
02-01-2003, 05:43 AM
You have to give the TDs a border too. Tables in CSS are a little different.

Read this:
http://www.w3.org/TR/REC-CSS2/tables.html
and especially this:
http://www.w3.org/TR/REC-CSS2/tables.html#borders

Note that browser support vary. Your borders should work OK though. :)

redhead
02-01-2003, 09:56 AM
erm... if you're putting a border declaration in the css, why do you put border="1" in the <table>...?

Catman
02-01-2003, 05:28 PM
Using border=1 will degrade more gracefully if the browser cannot render the CSS.

Grant Palin
02-02-2003, 01:51 AM
Meow- thanks for the tip. It works fine now.

Redhead- I hadn't edited it out yet. Besides, I wanted to show what the table should look like in the end.

Cataman- good tip. Although most browsers nowadays shouldn't have trouble with simple table border CSS, should they?