Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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>.

like image 820
codymanix Avatar asked Mar 09 '10 10:03

codymanix


People also ask

How do I select all TD in CSS?

Use a <table> element and set the width through the style attribute. Add a <th> element with the colspan attribute. Use two <tr> elements and place <td> elements inside.

Can we apply class to TD?

Classes (i.e. classnames) are used for styling the td element. Multiple classnames are separated by a space.

How do you select all elements in CSS?

The * selector selects all elements. The * selector can also select all elements inside another element (See "More Examples").


2 Answers

With a descendant combinator (represented by a space character):

table.myclass td { — }
like image 58
Quentin Avatar answered Oct 01 '22 12:10

Quentin


Don't this simple css will do it?

.myclass td{}
like image 26
Fitzchak Yitzchaki Avatar answered Oct 01 '22 11:10

Fitzchak Yitzchaki