tags:

views:

97

answers:

3

#div that holds table, table tr td.class of td now what goes here to style a div class I put inside of the td class?

+1  A: 

table tr td.class div

sharvey
gotcha so when I do div where you said, its a class. so do I dotable tr td.class #name of div in table?or table tr td.class .name of div in table?cause its a div class
Ralph The Mouf
+1  A: 

Is this what you're looking for?

td.class-of-td div.class-of-div {
    // Style of div of class "class-of-div" inside a td of class "class-of-td".
}
RichieHindle
gotcha so when I do div where you said, its a class. so do I dotable tr td.class #name of div in table?or table tr td.class .name of div in table?cause its a div class
Ralph The Mouf
To refer to `<div class='xyz'>` you need to say `div.xyz`.
RichieHindle
+2  A: 

If your code looks like this:

<div id="mydiv">
    <table>
       <tr>
          <td class="somecell">
             <div>some text</div>
          </td>
       </tr>
    </table>
</div>

.. then this CSS selector should do the trick:

#mydiv table tr td.somecell div

[Edited according to comment]

I'm not really sure what you mean, but I guess you should read up a little on CSS selectors :)

# represents an ID

. represents a class

The basic syntax of a selector is somewhat like this:

[Type][[# or .][name]] [.. next selector]

For example:

div#mydiv

.. will select a div with an Id of mydiv.

#mydiv

.. will select any object with an Id of mydiv

You can cascade the selectors by adding spaces between them, so:

div table.bluetable

.. will select all tables with a class of "bluetable" whose parent is a div.


Now, if I understood your comment correct, your code looks like this:

<div id="mydiv">
    <table>
       <tr>
          <td class="somecell">
             <div class="somediv">some text</div>
          </td>
       </tr>
    </table>
</div>

.. then your selector would be

#mydiv table tr td.somecell div.somediv

Or in case you don't care about the class of the td's

#mydiv table tr td div.somediv

And in case you just want all divs with class="somediv"

div.somediv

Hope it helps :)

Try one of the guides here: google search

cwap
gotcha so when I do div where you said, its a class. so do I dotable tr td.class #name of div in table?or table tr td.class .name of div in table?cause its a div class
Ralph The Mouf
Updated with a better explanation :)
cwap