Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Border Style For Cells of a Table with a specified Class 2

Status
Not open for further replies.

tnsbuff

Technical User
Jan 23, 2002
216
US
Hi,

How do I go about making the cells within a table inherit the same border style settings as the class that's defined for the table that these cells are in? I don't want to have to specify a class for each <td> or <th> unless absolutely necessary, and it doesn't seem like it should be necessary.

Thanks a bunch,

 
Use css, or add these in your style declaration:
Code:
th {
border-color: #c0c0cc;
border-style: solid;
border-width: 3px 3px 3px 3px;
font-size: &quot;12&quot;;
font-weight: bold;}

td {
border-color: #c0c0cc;
border-style: solid;
border-width: 1px 1px 1px 1px;
font-size: &quot;12&quot;;}

regards,
mansii
 
Thanks Mansil, but I don't want these settings for every td or th, just the ones that are inside a particular table for which I've specified a class.

I can't seem to get the cells to inherit the table's class settings. Do I have to specify a class inside each td and th tag in addition to the table?

Thanks,
 
If so, yes, you need to specify the class to each particular cell.
 
tnsbuff, this is what you are looking for:

.tableclass td {
border: blue solid 1px;
}

This will make every td inside this class have the specified border. You do the same for <th> tag.

Hope it helps.
 
WhooWhoo!! Thanks Vragabond!

I knew there was a way. I had it turned around. I was trying to use:

td.tableclass instead of .tableclass td

THANKS!!! You get a star! ;-)
 
Perfect! You deserved a star!
Can we add more options to it?
I need to define different cell with different fixed width.

In the old way:
Code:
:
.narrow{ width: 70;}
.wide{ width: 300;}
:
<td class=&quot;narrow&quot;>Narrow</td><td class=&quot;wide&quot;>Wide so so very wide.... </td>
Thank's before,
mansii
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top