CSS:
.structure { wIDth:960px; padding:20px; margin:0px auto 0px auto; background:#121212; border-left:5px #F06BA8 solID; border-right:5px #F06BA8 solID;}.header_home_structure { wIDth:960px; margin:0px auto 0px auto; position:fixed; height:80px;}.header_home_bg { wIDth:100%; background:#121212; border-bottom:3px #F06BA8 solID; height:80px; position:fixed;}
HTML:
<body> <div > <div > </div> </div> <div > </div></body>解决方法 只需使用position:固定在容器div上,不要使用它两次
Demo
.structure { wIDth:960px; padding:20px; margin:0px auto 0px auto; background:#121212; border-left:5px #F06BA8 solID; border-right:5px #F06BA8 solID;}.header_home_structure { wIDth:960px; margin:0px auto 0px auto; height:80px;}.header_home_bg { wIDth:100%; background:#121212; border-bottom:3px #F06BA8 solID; height:80px; position:fixed;}总结
以上是内存溢出为你收集整理的HTML – 为什么固定位置弄乱我的对齐?全部内容,希望文章能够帮你解决HTML – 为什么固定位置弄乱我的对齐?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)