14.2.1 'background-position' - block level only?

Ian Hickson wrote:

 > Section 14.2.1 of the CSS2 spec [1] lists the following:
 > 
 > >  'background-position' 
 > > Value:  [ [<percentage> | <length> ]{1,2} |
 > >           [ [top | center | bottom] || 
 > >           [left | center | right] ] ] | inherit  
 > > Initial:     0% 0%  
 > > Applies to:  block-level and replaced elements  
 > > Inherited:   no  
 > > Percentages: refer to the size of the box itself  
 > > Media:       visual  
 > 
 > Notice the "Applies to" says it's only for block-level and replaced
 > elements. However, all the other background properties, in particular
 > background-repeat, apply to everything. So, how do we get a single image to
 > appear behind some inline text?

Since all other background properties apply, the background image
should still appear behind -- but there is no way to indicate
preferred position of the background image. 

Having said that, I admit to not remembering why 'background-position'
doesn't apply to all elements. 

 > The problem which can come up is what to do with broken line boxes.
 > 
 > WinIE4 supports 'background-position' even with inline elements
 > (over-support of the spec?!), and gets around the problem by simply not
 > drawing the background if the line box splits.
 > 
 > I suggest the 'background-position' property be expanded to apply to
 > everything, with behaviour at line breaks being left up to the UA designer.

So you would treat the first line box as a block-level element, and
the background position would be undefined for the rest of the line
boxes? That sounds reasonable. Here are some alternatives:

 - leave it as is since it's too late to enforce interoperability and
   there's no single obvious good solution

 - say that background-attachment on inline elements is relative to
   the containing block (which is CSS2-speak for (in most cases) the
   "parent element")

 - say that background-attachment on inline elements is relative to
   the respective line boxes that are created.

The last proposal is a slightly more restricted variation of your
suggestion.

Regards,

-h&kon

H   ĺ   k   o   n      W   i   u   m       L   i   e
howcome@w3.org      http://www.w3.org/people/howcome
World     W      i     d     e       Web  Consortium

Received on Monday, 7 September 1998 15:11:46 UTC