On Jul 26, 2011, at 8:53 AM, Micky Hulse wrote:

> I never specify a unit for zero values, but some of the online CSS3
> tools will add units to the generated code:
> 
> <http://www.colorzilla.com/gradient-editor/>
> <http://css3generator.com/>
> 
> For example:
> 
> ...
> background: -moz-linear-gradient(top, #ffa443 0%, #ff7300 100%);
> ...
> 
> I assume that I can safely remove the percentage unit (%) from the
> zero value, correct?
> 
> I assume that for any zero value, no matter the CSS3 context, the unit
> can be omitted?

Not really. The unit identifier can only be omitted if the value is a <length>
http://www.w3.org/TR/CSS21/syndata.html#length-units
[quote]
After a zero length, the unit identifier is optional.
[/quote]
or CSS3 values (editor draft):
http://dev.w3.org/csswg/css3-values/#ltlengthgt

If '0' is an e.g. an <angle>, the unit identifier is requried.

In case of your gradients example, we're talking about a <color-stop>, which is 
basically a <length>
http://dev.w3.org/csswg/css3-images/#color-stop-syntax
so you can omit it, I think. 

Philippe
--
Philippe Wittenbergh
http://l-c-n.com/






______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to