Previous Message
Next Message

Re: [css-d] understanding contextual selectors

Sent by John Stoneham on 21 August 2002 18:06


> <div id="vision">
> <h3>Vision Statement: </h3>
> <p>This is the vision statement, for what it's worth</p>
>
> say that I want to style the DIV I would use
> 	div#vision
> and for the H3 I would use
> 	div#vision h3
> and for the P I would use
> 	div#vision h3 p
>
> No... what I need to use is
> 	div#vision p
>
> now is that because the </h3> occurs before the <p> ??

Precisely. 'div#vision h3 p' means 'select all paragraphs occurring inside
an h3 occurring inside a div with id 'vision''. This isn't what occurs in
your document (you'd have had to have some structure like
<h3><p>blah</p></h3>). 'div#vision p' means 'select all paragraphs
occurring inside a div with id 'vision'', which reflects your markup as it
stands.

- John Stoneham
Previous Message
Next Message

Message thread: