- From: Sigurd Lerstad <sigler@bredband.no>
- Date: Mon, 15 Sep 2003 04:30:13 +0200
- To: "Bert Bos" <Bert.Bos@sophia.inria.fr>, <www-style@w3.org>
- Cc: <www-style@w3.org>
> > Where is the syntax of property value attr(x,y) described? > > > > In CSS2, there's only attr(x), so attr(x,y) must be new to CSS3? But I can't > > find where it's described. > > It is currently meant to go into the Values & Units module. Is it long before it's available? > The idea is to generalize attr() a bit. The optional second argument can > be a type ('string', 'color', 'url', 'length'...) to allow attr() to be > used on properties that allow other things than strings. E.g., the type > 'url' would indicate that the attribute value is a URL reference relative > to the document, because simply taking the attribute as a literal string > would give the wrong URL. The default type is 'string'. I don't understand why specifying a type would be necessary. The property on which attr is set defines the type? if you have body[TEXT] { color: attr(TEXT)} the color attribute knows it has a type of color.. same with a uri, the background-image property knows it has a uri. ?? I've also seen 'em' as the second argument, I see the need for that, input[size] {width: attr(size, em) } but how is that a type? I'm especially interested in that construct, completely implementing form controls through css. > There is also an optional third argument, which acts as the default if the > attribute is not present in the document or cannot be converted. If the > third argument is omitted, the default depends on the type, the default > for 'string', e.g., is the empty string. > > The proposal will have many details about the types and defaults. But the > interesting question is how well it will work with existing and expected > XML-based formats. It will allow 'BODY {background: attr(BGCOLOR,color) }' > and 'OL { counter-reset: list-item attr(START,integer) }', but it won't > help setting borders on the descendants of "<TABLE BORDER=2>". That > particular example is probably not a good counterargument, since we have > been doing fine without the BORDER attribute anyway, but there may be more > compelling examples outside of HTML. >
Received on Sunday, 14 September 2003 22:26:35 UTC