Re: [css3-background] error in box-shadow examples?

Håkon Wium Lie wrote:
> Also sprach Brad Kemper:
>
>   
While we are on this page I'd like to mention that definition of drawing 
order
here http://dev.w3.org/csswg/css3-background/#box-shadow is not correct.
At least for practical use cases.

Please see attached image. Markup there is
<body>
  <div class="with-shadow">First</div>
  <div>Second</div>
</body>

Shadowed elements shall be drawn on a separate layer to achieve 
rendering as on the image.
That is pretty much the same layer that 'outline' uses (that is why I 
proposed to make
shadows as just special type of outline).

Algorithm is close to this:

1) Draw all elements that have no shadow set.
2) Draw shadow for elements with shadow on top of normal elements.
3) Draw shapes of shadowed elements (but not their shadow).

By their nature elements with shadows have "z-index" higher than other 
elements.

There are also special cases that needs to be mentioned:
a) Scrollables clip shadow of their children.
b) Shadows of positioned elements (relative, absolute, fixed) use also 
algorithm above
but on their own layer.

--
Andrew Fedoniouk.
http://terrainformatica.com

Received on Monday, 26 January 2009 18:45:45 UTC