Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to arrange order of stacked divs backwards?

Tags:

html

css

Suppose I have the three divs:

<div>1</div>
<div>2</div>
<div>3</div>

I need the output in the browser to be:
3
2
1

Is there any way to accomplish this without absolute positioning? I tried floats, but it seems you can only reverse it in the horizontal space.

They need to stack VERTICALLY in reverse order.

like image 418
user1405177 Avatar asked Dec 28 '25 15:12

user1405177


1 Answers

You could do something like this: EXAMPLE HERE

Wrap the elements, and rotate both the parent and children elements 180 degrees.

#parent, #parent > div {
    transform:rotate(180deg);
    -webkit-transform:rotate(180deg);
    -moz-transform:rotate(180deg);
    display:inline-block;
}

Alternatively, this would work too:

#parent, #parent > div {
    display:inline-block;
}
#parent > div {
    float:right;
}

EXAMPLE HERE

like image 119
Josh Crozier Avatar answered Dec 31 '25 17:12

Josh Crozier