css how to define a class for table to control the style of table rows

Tags: css,table,row,tr

Problem :

I'm wondering if I can define a class that could also control the row styles within the table.

Lets say I define a class "aTable"


I also want to define the row styles. So when I assign this class to a table, all the rows in that table would follow the design, let say background-color:#e9e9e9;

Thanks for your help!

Solution :

You can achieve it like this:

.aTable {
    width: 800px;
    border-spacing: 2px;
.aTable tr {
    background-color: #DDD;

    CSS Howto..

    show/hide will not load

    How to link to a CSS if a certain condition happens?

    How to hide label on radio checked using css

    How to make Superfish menu vertical in first level but horizontal in second level?

    How do I use the CSS box-model to make sure my body is spaced from the edge of the window despite being 100% high?

    How to wrap a DIV around a DIV with CSS

    Since KB2898785 IE6 doesn't load locally-sourced CSS for a page delivered remotely--how to correct?

    CSS frustration: How to center floating images of different widths inside LI tags?

    How to reduce font weight in Firefox on Mac with CSS?

    How can I do the following thing without inline styling?

    How to get jQuery to recognize mouse over image once per hover

    How can I find the CSS3 rotation of an element?

    How to edit menu in header - wordpress

    CSS, Javascipt, HTML, how can i align a text inside a div to middle beside an image? and animate the text

    How to debug CSS with Firebug for an element that only appears when clicked?

    JavaScript and SEO. How Should I reconcile them?

    how to make cross browser css ellipsis?

    How to create a header.php and footer.php with CSS files?

    How to make an object go to a higher layer

    Jquery Mobile dynamic thumbnail list-How to create a border?

    How to implement multiple background-images for an id / class with the same CSS code?

    How could I use pseudo-element :after :before conditionally

    How to change focus color when input is filled in with required attribute javascript/html/css

    How to access regular CSS from GWT widget?

    How to Center-Justify links in CSS?

    stopping slideshow and continue after 3 seconds

    How to create a fixed menu (links come from right to left) - HTML & CSS

    How to toggle class using jquery if else statement?

    How can I incorporate a slideshow into HTML?

    How to make the progress bar with html css javascript