View Full Version : Affecting only TR within certain table

05-21-2007, 09:55 PM
How would I affect all TRs within a certain table without having to assign a class to each TR element?

I thought it was something like ".ClassName table tr {vertical-align:text-top;}" but that obviously doesn't work.

05-21-2007, 10:57 PM
If the table whose rows you wanna address doesn’t have an ID or class yet assign it (<table id="whatever"> and apply the styles like that:

#whatever tr {…}

or if it has a class

.classname tr {…}

What you have (.ClassName table tr {vertical-align:text-top;}) would only apply to a table within an element with class ClassName.

05-22-2007, 05:18 PM
Apart from that vertical-align (http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align) does not apply to the table-row element.

It only works in Firefox and IE due to a bug. But it won't work in for example Opera 9. Check browser comparison chart (http://www.webdevout.net/browser-support-css#support-css2propsbasic-verticalalign).

You should apply vertical-align directly to the table-cell (td element).