PDA

View Full Version : Borders again


dwoody
08-20-04, 11:00 PM
Hey,
I was wondering how to get my border style to effect all the borders on the table. I have a table with multiple cells here but my style seems to only apply to the outer border. How would i get a border that would show all cells?



<html>

<style>

.thetable{border: 2px solid red}

</style>

<body>

<table cellspacing="0" cellpadding="0" class="thetable">
<tr><td width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
<tr><td width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
<tr><td width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
<tr><td width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
</table>

</html>

alpha453
08-26-04, 09:52 AM
your applying the css class to the table itself, your trying to effect the td, so use this:

<html>

<style>

.thetable{border: 2px solid red}

</style>

<body>

<table cellspacing="0" cellpadding="0">
<tr><td class="thetable" width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
<tr><td class="thetable" width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
<tr><td class="thetable" width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
<tr><td class="thetable" width="100" height="100">&nbsp;</td><td width="100" height="100">&nbsp;</td></tr>
</table>

</html>


As you can see its <td class="thetable">

jamslam
08-31-04, 12:24 AM
Sorry to but in, but that way seems awfully inefficient. Here is a better way:
.thetable {
border-right: 2px solid #ff0000;
border-bottom: 2px solid #ff0000;
}

.thetable th, .thetable td {
border-top: 2px solid #ff0000;
border-left: 2px solid #ff0000;
}
And you can keep the same HTML as you have in the first post, just use that as the CSS.

alpha, that method also produces overlapped borders ;)