how would i define the text color in the css if my page is like this...
<div = "menu">
<table>
<tr>
<td bgcolor = "#880000">
<p>This is the text I want blue</p>
</td>
</tr>
</table>
</div>
| SitePoint Sponsor |



how would i define the text color in the css if my page is like this...
<div = "menu">
<table>
<tr>
<td bgcolor = "#880000">
<p>This is the text I want blue</p>
</td>
</tr>
</table>
</div>





I would do it like this:
Or, if you want to assign a special class to the <p> inside the table cell, you should use:Code:p {color: #0000FF;}
And you should call on this class like:Code:p.blue {color: #0000FF;}
The code I posted does belong in an external stylesheet. Give me a buzz if you don't know how that works.Code:<div = "menu"> <table> <tr> <td bgcolor = "#880000"> <p class=blue>This is the text I want blue</p> </td> </tr> </table> </div>
If you're really targetting just that table i think marks suggestion of assigning a class would work best.



What does the <div> do? I thought that that gave me a label to the section. I need to show that this <p> in the table is different that the <p> for the rest of the document.
The class would work, but I thought that I could take advantage of the div=menu.





I never use the <div> tag, when I am building a site. The class will distinguish the <p class=blue> from all the other <p>-tags you use in the document. This allows you to do what you wanted to accomplish.
The best option you have in my opinion, is to use a stylesheet. This is also quite useful when your site is content-heavy, or starting to become like that. This allows you to implement a simple change, for example the font used, on all pages.




If you are only going to be using the menu <div> once on the page, you can also utilize id for the menu vs class for each individual <p> tag.
To identify an id in your stylesheet:
Then you could specify attributes for all <p> tags within the id:Code:#menu {some css attributes for your div}
This will assign the color:#0000ff; to every <p> tag within the <div id="menu"> & save you having to assign class="foo" to every <p> tag.Code:#menu p { color:#0000ff; }
HTH![]()




You could do:
div.menu p {
color : #0000FF;
}
<edit>
Looks like isotope235 beat me to it.
</edit>



Thats what I thought... but it wasnt working. It was taking the <p> characteristics from when I just definied p
Thanks for your help... I will post my specific code later.
Bookmarks