2012-09-19 55 views
0

我在我的css文件中有很多div。现在我在我的html页面中显示了适当的布局,但是存在一个严重的问题,即:如果我在中心div中显示信息,则只显示其中的一部分,而其他信息由标题覆盖。CSS在标题后面显示信息?

这意味着center div不是在标题后面开始,而是在标题后面,因此数据显示在标题后面。背后是他们两人的代码。

#header{ 
/*background-color: #3B5998;*/ 
background-image:-moz-linear-gradient(center bottom , #ebebeb, #999999); 
    background: #F6F6F6 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#999999), to(#ebebeb)); 
height:60px; 
position:fixed; 
left:0; 
width:100%; 
} 



#center { 
margin-right:200px; 
background-color:white; 
min-height:700px; /* for modern browsers */ 
height:auto !important; /* for modern browsers */ 
height:700px; /* for IE5.x and IE6 */ 
color:black; 

} 

有没有什么东西在这里会导致这个问题?一个图像附加到这个帖子,显示只有图像显示,而不是文本上方。如果我添加3
它显示文本。 enter image description here

+0

“我在我的CSS文件的div很多。” ......你知道吗?你确定? –

回答

1

margin-top: 60px;添加到中心div。

#center { 
margin-right:200px; 
margin-top: 60px; 
background-color:white; 
min-height:700px; /* for modern browsers */ 
height:auto !important; /* for modern browsers */ 
height:700px; /* for IE5.x and IE6 */ 
color:black; 

} 

因为你的头是位置:fixed;它已经被排除在文档流程之外,因此除非给出指示向下移动,否则任何元素都将出现在它的下面。

诀窍是让margin-top与header元素的高度相同。

+0

这是我的朋友。欣赏支持,即使它是一个简单的初学者问题:) –

+1

没问题,如果你不知道这些东西可以是莫名其妙的:) – Kyle

0

尽量把float:left所有,如果u能得到作为屏幕截图这是更好地解决这个问题