Re: a:hover and a:active and named anchors
Ian Hickson <ian <at> hixie.ch>
2002-08-01 09:09:45 GMT
Coises wrote:
> I'm going to guess that what that principle means (I don't recall the
> original statement, if I ever heard it) is that the determination of which
> *elements* may be matched by a given a selector cannot depend on the CSS
> properties of (any) elements.
>
> This does not apply to pseudo-classes and pseudo-elements, though. For
> example, in CSS2, the ":first-line" pseudo-element can apply only to a
> block-level element; but whether an element is block-level or inline-level
> is dependent on the "display" property.
Pseudo-elements are a case of where a property ('display') on another element
(the block) causes a new element (in this case, pseudo-element) to be generated.
This then causes the new element to find which rules match it.
The CSS model is applied on a per-element basis, in document order, like this:
For each element:
1. Find all rules matching the element or pseudo-element.
2. Apply all the relevant properties.
3. If this has created any new elements or pseudo-elements, add them to the
list of elements to process.
Step 2 cannot affect step 1 of the same element or pseudo-element.
Note that 'display' doesn't actually change which rules match '::first-line' --
the same rules match, it's just a matter of whether the styling system does
anything with those rules or not (i.e. whether the first-line exists or not.)
(Continue reading)