W3C home > Mailing lists > Public > www-style@w3.org > August 2011

RE: Splitting background-position in two different attributes

From: Brian Manthos <brianman@microsoft.com>
Date: Thu, 18 Aug 2011 17:00:05 +0000
To: Øyvind Stenhaug <oyvinds@opera.com>, Alan Gresley <alan@css-class.com>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <9710FCC2E88860489239BE0308AC5D17123C37@TK5EX14MBXC264.redmond.corp.microsoft.com>
That's not how it works.  There's no such thing as...
	background: <leave-attachment-unset> blue ...;

Absent (sub-) properties for a shorthand are *set* to the initial values when absent from the value portion of the "background: value;".

http://www.w3.org/TR/css3-background/#background

# Given a valid declaration, for each layer the
# shorthand first sets the corresponding layer of
# each of ‘background-position’, ‘background-size’,
# ‘background-repeat’, ‘background-origin’,
# ‘background-clip’ and ‘background-attachment’
# to that property's initial value, then assigns
# any explicit values specified for this layer in
# the declaration. Finally ‘background-color’ is
# set to the specified color, if any, else set to
# its initial value.

Again, an example...
	background: blue;
is not equivalent to...
	background-color: blue;
but rather...
	background-attachment: scroll;
	background-clip: border-box;
	background-color: blue;
	background-image: none;
	background-origin: padding-box;
	background-position: 0% 0%;
	background-repeat: repeat;
	background-size: auto;


> -----Original Message-----
> From: www-style-request@w3.org [mailto:www-style-request@w3.org] On
> Behalf Of Øyvind Stenhaug
> Sent: Thursday, August 18, 2011 5:52 AM
> To: www-style@w3.org
> Subject: Re: Splitting background-position in two different attributes
> 
> On Thu, 18 Aug 2011 14:08:48 +0200, Alan Gresley <alan@css-class.com>
> wrote:
> 
> > Thank you Brian. The examples you gave has made me think. At this
> moment
> > of time, neither 'background-position-x' nor 'background-position-y
> can
> > be expressed in shorthand values for 'background' I'm not proposing
> any
> > syntax (just made up to express what I see as an issue) but something
> > like the following would have to appear in a 'background' shorthand
> > declaration.
> 
> Nothing would *have to* be added, shorthands don't necessarily have to
> be
> able to set every possible combination of values the individual
> properties
> allow. For instance, the border shorthand can't be used to set
> different
> border colors on different sides.
> 
> And since shorthands always set a value for every property that has
> been
> omitted anyway, the only point in adding a new syntax would be to be
> able
> to skip one keyword/value:
> 
> > background: url(wow.png) x(20px) no-repeat;
> 
> background: url(wow.png) 20px no-repeat;
> or
> background: url(wow.png) 20px 0 no-repeat;
> depending on which one you want
> 
> > background: white url(who.png) y(10%);
> 
> background: white url(who.png) center 10%;
> or
> background: white url(who.png) 0 10%;
> depending on which one you want
> 
> > background: url(we.png) xy(20px, 10%) repeat-y;
> 
> background: url(we.png) 20px 10% repeat-y;
> 
> --
> Øyvind Stenhaug
> Core Norway, Opera Software ASA
> 

Received on Thursday, 18 August 2011 17:00:37 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:43 GMT