[whatwg] CSS idea: y-index

Robert O'Rourke rob at sanchothefat.com
Mon Feb 4 10:08:38 PST 2008


This has probably come up in some form or another already but incase it 
hasn't i decided to share the idea.

Say you have 3 <div>s:

<div id="div1"> div1 </div>
<div id="div2"> div2 </div>
<div id="div3"> div3 </div>

and the following CSS (assuming a default y-index of 0):

#div3 {
    y-index: -1;

The output would be:

<div id="div3"> div3 </div>
<div id="div1"> div1 </div>
<div id="div2"> div2 </div>

The idea is that CSS can control the source order at the rendering 
stage, so the HTML still has its ideal source order but for styling 
purposes bits can be moved up or down. I know there's such a thing as 
positioning however it would be nice to have the option to keep things 
in-flow, especially where generated content is concerned. In my line of 
work I do a lot of templates for CSS coders to use and I can't please 
everyone or allow /every/ possible design to be acheived. Something like 
this would be a major bonus.

The property could also be called 'order' or something to that effect.

Anyway, back to work =]


More information about the whatwg mailing list