Maison  >  Article  >  interface Web  >  一个关于position: fixed;的问题_html/css_WEB-ITnose

一个关于position: fixed;的问题_html/css_WEB-ITnose

WBOY
WBOYoriginal
2016-06-24 12:08:03954parcourir

我网页的header部分设置成了position: fixed;
正文部分的上端却被header遮住了

#header {    height: 87px;    left: 0;    overflow: visible;    position: fixed;    right: 0;    top: 0;    z-index: 10000;}#header, #footer {    margin: 0 auto;    width: 100%;}

正文部分的css:
#wrapper {    background: none repeat scroll 0 0 #EDF0EB;    height: 500px;    margin: 0 auto;    padding-bottom: 20px;    padding-top: 20px;    position: relative;    width: 1024px;}

问题出在哪里呢


回复讨论(解决方案)

错在你没把HTML贴出

#header 设置了    z-index: 10000;

#wrapper 设置一下 margin-top: 100px;

http://babybang.com/
这个网站没有设置margin-top: 100px;  也是z-index: 10000;   怎么他没有覆盖呢

错在你没把HTML贴出
+是啊。

#wrapper {
    background: none repeat scroll 0 0 #EDF0EB;
    height: 500px;
    margin: 0 auto;
那你这个margin-top 为 0 了啊

#wrapper {
    background: none repeat scroll 0 0 #EDF0EB;
    height: 500px;
    margin: 0 auto;
那你这个margin-top 为 0 了啊 http://babybang.com这个网站的正文  margin-top: 0;也没有遮盖呀

她的body上有
padding-top: 62px;

有人知道么

看来是对牛弹琴了,不是有margin-top就是有padding-top不是明摆着的事吗
你的源码贴全了,让大家看看

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn