views:

49

answers:

6

How can I format all td elements contained in a table with class myclass in CSS?

I want a format rule which applies to <table class="myclass"><td>FORMAT THIS</td></table>.

+2  A: 
 table.myclass td { color: blue }

Your table is missing a tr element by the way.

Pekka
+2  A: 

With a descendant selector:

table.myclass td { — }
David Dorward
+1  A: 

...........

table.myclass td{
 /* your styles */
}

Have a look at CSS selectors for more info.

Sarfraz
+1  A: 

as far as i am aware you would do this

table.myclass td { styles in here }
Mauro
+2  A: 
table.myclass td { ... }
Philip
+1  A: 

Don't this simple css will do it?

.myclass td{}
Mendy
it does, however if myclass is added to any other parent element (e.g. a div) the td's will be styled. e.g. `<div class="myclass"><table class="blueBorderOnCells"><tr><td>Example</td></tr></table></div>` Example would be styled with a "blue border" AND all styling in myclass.
scunliffe