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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I apply styles only to TD tags?

Status
Not open for further replies.

dkh7m

Programmer
Joined
Mar 3, 2005
Messages
1
Location
US
here's my problem...i'm in design mode. i select an entire row of cells to apply a CSS style to. when i apply the style, it is applied to the TR tag, rather than each individual TD tag. the only workaround i've found is to select all but one cell in the row, apply the style, then go back and apply the style to the last cell by itself.

i seem to recall there being a setting in the old DW that would let you apply styles to TD tags by default, instead of TR tags. but i can't find that setting in DWMX. am i just blind, or does it not exist anymore?
 
setup a td class using css and then just select each td and apply

[Peace][Pipe]
 
...
OR, instead of writing your stylesheet like this:

Code:
.cellstyle {
  background-color : yellow;           /* or whatever */
}

you could do it like this:

Code:
.cellstyle TD {
  background-color : yellow;           /* or whatever */
}

Now you can go ahead and apply the style to the TR. By adding the TD selector in the stylesheet, you have ensured that the style will cascade down to the cell level, and you have avoided having to put class="cellstyle" in every single frickin' TD. If you have 8 rows and 8 columns in your table, doing it my way would trim your page size by a whole kilobyte--not to mention making it a lot easier to read.

(Remember the bad old days when you had to put a font tag inside every TD? <old-codgery laugh>)
.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top