W3C home > Mailing lists > Public > www-svg@w3.org > January 2006

Proposal for unitless lengths (Was: Is the px unit equivalent to user units?)

From: Jonathan Watt <jonathan.watt@strath.ac.uk>
Date: Wed, 04 Jan 2006 18:54:03 +0000
Message-ID: <43BC19CB.2060102@strath.ac.uk>
To: www-svg@w3.org, Dean Jackson <dino@w3.org>
CC: Chris Lilley <chris@w3.org>

Dean Jackson wrote:
> If we can have a solution where authors get to use stroke-width="4" in 
> XML content and are required to use "{stroke-width: 4px}" in 
> stylesheets, then I'm happy. I would be happier if CSS hadn't required 
> units on <length>s, but I have a sneaking suspicion that that won't change.

Me too. So how about for the sake of its implementors and its users the SVG WG 
be the one to back down in this case. This issue has gone on way too long, and 
it is SVG users that are being hurt, not the CSS-in-HTML crowd.

I'm not entirely happy about having to use units in CSS, but assuming we're the 
ones to back down, I propose that the SVG WG change some of the properties to 
accept a <number> as well as a <length>. There are eight properties relevant to 
SVG that can currently take a <length> (and thus are affected by this issue):

Four SVG-only properties:

Four CSS properties:

The SVG-only properties could be changed to allow <number> and define the value 
to act in user units. Something like:

     Value:        <length> | <number> | inherit
     Initial:      1
     Applies to:   shapes and text content elements
     Inherited:    yes
     Percentages:  Yes
     Media:        visual
     Animatable:   yes

     Acts as if a unit of 'px' had been specified (i.e. the value is in
     user units).

(That text of course assumes that px IS always equivalent to user units.)

I'm not sure what to do about the remaining four "generic" CSS properties. 
Perhaps a request to the CSS WG that they also allow <number> for those 
properties and define them to behave as if 'px' had been provided as the unit? 
It would solve our backwards compatibility problems with existing content, and 
since they haven't defined <number> for these properties I assume they don't 
have a use in mind for it and never will.

Anyway, regardless of the response of the CSS WG to that request, I think that 
removing the problem from the four SVG specific properties would be *very* 
beneficial and worthwhile. It is a *lot* easier for users to remember the names 
of four generic CSS properties to which they must add 'px' than it is to 
remember the names of a mixture of eight CSS and SVG properties. It would also 
allow some of the content that is currently a problem to work in UAs that put a 
higher priority on CSS than SVG conformance.

Received on Wednesday, 4 January 2006 19:36:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:06 UTC