我遵循以下不能更改的HTML结构。它包含三个垂直div。我只想使用CSS来更改div的位置,以便第二个div出现在顶部,第一个和第三个div出现在这之后(只有重要的是第二个div应该出现在顶部)。使用CSS更改div订单
我想使用下面的CSS代码,它显示第二个div在顶部,但隐藏第一个div。如何在此之后显示其他两个div?所有三个div都有不同高度。
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/
您可以更改CSS文件,但不能更改HTML? – hjpotter92
你见过[this](http://stackoverflow.com/q/220273/944681)吗? –
div的高度是否固定? –