W3C home > Mailing lists > Public > www-style@w3.org > October 2013

Referring to elements from CSS. (In, but not limited to [css-images-4] and [css-gcpm])

From: Simon Sapin <simon.sapin@exyr.org>
Date: Tue, 01 Oct 2013 21:35:49 +0100
Message-ID: <524B3225.8060604@exyr.org>
To: www-style@w3.org

We have two drafts with features that refer to an element from the value 
of a CSS property. They do so with two different mechanisms; I think we 
should pick one preferred way.

* The element() function in css-image-4 takes an ID selector.
* The cross-reference functions in css-gcpm such as target-counter() 
take an URL (which needs to be in the same document and have a fragment 

Even though the two may seem similar (#foo), they are different in 
syntax (eg. character escaping) and semantics (<a name=foo> is a 
fragment target but not an ID.)

ID selectors are the easiest from a spec point of view: we can just 
refer to the Selectors spec and we’re done. For URLs however, we need to 
define how fragments are mapped to elements or refer to something that 
does. This is probably defined in HTML, but CSS so far is supposed to 
support any type of document and maybe shouldn’t depend on HTML.

URLs on the other hand are very nice for using 'attr(href url)' on link 
elements. 'target-counter(attr(href url), page)', for table of contents, 
is a typical use case for target-counter().


Simon Sapin
Received on Tuesday, 1 October 2013 20:36:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:51:02 UTC