Forum Moderators: not2easy

Message Too Old, No Replies

child selectors

         

esk2004

11:18 am on May 21, 2007 (gmt 0)

10+ Year Member



hi all.
i was wondering if there was a way to select the child of a parent id...
E.G
<div id="leftcontent2">
<div id="NavHeading">Latest News</div>
<div id="NewsDate">&gt; 01.02.2007</div>
<div id="NewsHeading">hits double figures</div>
<div class="NewsContent">Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Maecenas quis nisi. Mauris tortor orci.</div>
</div>

is it possible to access the navheading and newsdate of the preceeding leftcontent2 id?
something like:
div#leftcontent2 > #NavHeading {
some css stuff here;
more css stuff here;
}
or would using a class be better...?

Robin_reala

11:52 am on May 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld esk2004!

Your CSS is correct, but slightly redundant. As ids are unique to a page you don't need to use the child selector in this case - you can just use #NavHeading.