P inside a DIV - how?

windows

Guest
How can I give a P element my own CSS while it's inside a cetain DIV?

<div class="right_box">
<p>
text text text text text text
</p>
</div>

Thanks!You'll want to use the descendant (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/selector.html#descendant-selectors">http://www.w3.org/TR/CSS21/selector.htm ... -selectors</a><!-- m -->) selector.

.right_box p {
/* Place styles for any paragraph tag inside an element whose class
name is "right_box". */
}

If Internet Explorer was a real browser, you could also use the child selector (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/selector.html#descendant-selectors">http://www.w3.org/TR/CSS21/selector.htm ... -selectors</a><!-- m -->).

.right_box>p {
/* Place styles for any paragraph tag inside an element whose class
name is "right_box". */
}You could also use an ID if it is unique in the document.

"right_box" sounds rather specific so maybe that should be an ID too? (who knows, that ain't what ya asked anyway.) There would be an almost limitless number of ways of doing it, but as Toicontien pointed out, IE screws up all but a few of them.
 
Back
Top