Jukka K. Korpela wrote:

> 18.8.2011 8:40, Rick Gordon wrote:

>> I'm just wondering how I might approach addressing a tag that appears just 
>> before another tag, lick the <p> tag that would immediately precede an <h1>. 
>> The adjacent sibling selector p > h1 would give me access to the attributes 
>> of the <h1>, but what if I wanted to modify a property of the <p> in that 
>> context?

> In CSS, you cannot, except in the trivial sense that you can manually add 
> class attributes to such tags and then use a class selector.
> Even in the CSS 3 Selectors draft there is no selector construct for such 
> purposes.
> Using JavaScript you could of course traverse the document tree and e.g. add 
> a suitable class property to elements by such criteria.

Would you not agree, Jucca, that there is another issue
here, and that is the definition of what constitutes
"a tag that appears just before another tag".  Even the
example given :

> the <p> tag that would immediately precede an <h1>

doesn't really clarify the situation, since I cannot
think of any context in which a <p> tag might immediately
precede an <h1>.  I can think of examples (contrived)
that might place a </p> just before an <h1>, but the
example given just doesn't tally with my vision of reality.

Would you also agree that Rick Gordon might do better
to forget about tags as such, and rather think in terms
of elements, and then re-formulate his question in
terms of the document tree rather than in terms of
a particular serialisation ?

Philip Taylor



______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to