我在容器中加入了个headerDIV块,这个块加了边框,与容器边的距离也是刚好按我设定的margin值显示,但是我一把header的边框一去,header这一块就会与容器的上边框空出一段距离,也不知道是为何,求高手指教!
#container{width:820px; height:100%;border:1px solid #b58505;margin:0px auto;}.top{width:100%; height:52px; font-size:18px;text-align:right; line-height:40px;padding-right:20px; margin-left:-10px; margin-top:-10px;background:url(../images/top.gif) repeat-x;}.top a:hover{ color:red; text-decoration:underline;}.top #srh{ vertical-align:top; margin-top:10px;width:150px; height:18px; border:1px solid gray;}#header{width:812px; height:303px;border:1px solid gray;margin:2px auto 0px;background:url(../images/header_bg.png) no-repeat center;}
回复讨论(解决方案)
这不加边框空的都应该是一样的,如果不一样也只是差一个边框的厚度
是不是你去掉边框看不出界线在哪里,所以以为空的多了?
问题很多,不细究,除了最外面的层,另外.top同#header层都加一个 float:left; display:inline; 试试
发两个效果的图看看
问题很多,不细究,除了最外面的层,另外.top同#header层都加一个 float:left; display:inline; 试试
可以解决,但是这是为什么呢?
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:php中文网