I've following HTML structure which can not be changed. It contains three vertical divs. I want to change the position of divs using CSS only so that the second div appears at top most and the first and third divs appear after this (only important thing is that second div should appear at top).
I am trying using the following CSS code, it displays the second div at top, but hides the first div. How can I display the other two divs after this? All three div's have different heights.
HTML:
<div class="wrap">
<div class="one">
This should be third.
</div>
<div class="two">
This should be first.
</div>
<div class="three">
This should be second.
</div>
</div>
CSS:
.wrap{
width: 100px;
overflow: hidden;
position: relative;
}
.one, .two, .three{
width: 100px;
margin-bottom: 10px;
background: yellow;
}
.two{
position: absolute;
top: 0;
background: green;
}
JSFiddle: http://jsfiddle.net/UK6vK/