我有一个类似这样的页面
<div id="top">
</div>
<div id="bottom">
</div>
我想要一个先显示底部然后显示顶部的输出。我如何使用 CSS 来实现这一点?
我有一个类似这样的页面
<div id="top">
</div>
<div id="bottom">
</div>
我想要一个先显示底部然后显示顶部的输出。我如何使用 CSS 来实现这一点?
借助“职位”,您可以实现这一目标..
If your question means, the following.. "You would want to place div#bottom on top of the other drawn DOM elements below". DOM ordering.
div#top {
width:200px;
height:100px;
background-color:red;
}
div#bottom {
position:absolute;
width:100px;
height:50px;
background-color:blue;
top:10%;
left:4%;
}
The top and left values are values of your choice, the above example places the bottom inside the top.
positioning - Can be used to manipulate the same. You could use fixed element inside a huge encompassing div. But use fixed only if you are sure that the DOM contents is to be shown even on a overflow. 'relative' positioning might as well work when you are working reference is the body or the Root Node class or element.
document.getElementById('bottom').style.display = 'block';
document.getElementById('top').style.display = 'none';
After a timeout setTimeout(function() { document.getElementById('top').style.display = 'block'; }, 200);
<div id="top_div">
<div id="bottom_div">
</div>
</div>
在 css 中使用 Position 它应该可以在下面尝试
<div id="bottom">
</div>
<div style="clear:both;"></div>
<div id="top">
</div>
HTML 页面从上到下呈现。反转您的 div 标签,如下所示:
<div id="bottom">
</div>
<div id="top">
</div>
除非您有特定的理由不这样做。