Re: URLs in CSS

From: Hakon Lie <howcome@w3.org>
|  
|  Several CSS properties take URL values. Up to now, URLs have been
|  identified with quotes. This works quite well for absolute links:
|  
|    BODY { background: "http://foo.com/png/marble" }
---

I would *strongly* urge that quotes have no special semantics beyond
grouping characters into a string - it's just too confusing.  You *need*
to have a way of unambiguously indicating that a sequenec of characters
is a single value, regardless of its context, and that should be what
quotes mean.

I'm pretty sure that's what the formal grammar says - that a
sequence of characters surrounded by quotes is a string.  The quotes
should never be visible to the parser at all - the lexer should have
used them to turn the surrounded characters into a token of type string.

---
|  Here are some suggestions for alternative schemes;
|  
|    BODY { background: [http://foo/bar] }
|    BODY { background: url:http://foo/bar }
|    BODY { background: href:red }
|    BODY { background: url:red }
|    BODY { background: url(red) }
|    BODY { background: url(http://foo/bar) }
---

I'd slightly prefer url(...) over href(...). It generalizes naturally to
explicitly indicating other units.  I would avoid using another colon,
just to make life easier for the parser.

---
|  Also, should the identification be optional for absolute URLs?:
|  
|    BODY { background: http://foo/bar } 
---

I guess I would require it wherever the syntax allows alternative units
that could be confused - that is, if you had a property whose value was
*always* a URL, it would be OK to omit it there, but it would be
required wheever the units alternatives left it open to interpretation.
While it's unlikely that the name of a color would be a string that
started "http:", it's quite possible that for some other property it
*would* be ambigous.  For instance, if you had a "Footer" property, you
would have no way of knowing whether "http://..." was meant to be a
string that would be printed in the footer or meant to be a URL where
the actual footer contents would be found.

scott

--
scott preece
motorola/mcg urbana design center	1101 e. university, urbana, il   61801
phone:	217-384-8589			  fax:	217-384-8550
internet mail:	preece@urbana.mcd.mot.com

Received on Thursday, 11 April 1996 09:19:06 UTC