CSS实现类似的固定浮动div总是在其他div的顶部 - 像stackoverflow吗? [英] CSS to achieve a similar fixed floating div thast always on top of other divs - like stackoverflow does?
本文介绍了CSS实现类似的固定浮动div总是在其他div的顶部 - 像stackoverflow吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想达到与此图片中类似的效果:
I'd like to achieve a similar effect as the one in this image:
在这里输入链接description http://img843.imageshack.us/img843/8328/floatingheader.png
基本上,我想有一个div作为菜单栏总是在顶部 - 它下面的div是我的内容的容器div。点击菜单栏中的任何链接只会更改容器div中的内容。
Basically, I want to have a div as a menu bar that's always on top - the div beneath it being the container div for my content. Clicking any links in my menu bar only change the content in the container div.
推荐答案
您需要使用 position:fixed
属性。
<div id="top"></div>
#top{
position:fixed;
top:0px;
width:100%;
height:70px;
}
这篇关于CSS实现类似的固定浮动div总是在其他div的顶部 - 像stackoverflow吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文