两个div之间的匿名空白 [英] Anonymous white space between two divs

查看:101
本文介绍了两个div之间的匿名空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是小提琴,



我有两个 divs 一个用于标题,另一个用于主体。在用于标题的 div 中,我有另外一个 div ,而div是浮动左。由于浮动,这两个 divs 之间出现空白区域(在main和div的div之间身体)。



[注意:请参阅 #DivLogo 在小提琴的css部分]



我的问题是,为什么这种问题因浮动而上升。

解决方案

这是使您的#DivHeader为 inline-block 。将其更改为 display:block 并将 overflow:hidden; 设置为包含浮点数。请参阅 http://jsfiddle.net/jhcUb/


Here is the Fiddle,

I have two divs one is for header and the other is for the main body. Inside the div which is for header, i'm having another div and that div was floated left. Due to that floating, a white space has occurred between those two divs (between the div for header and div for main body).

[Note: Please refer #DivLogo in the css section of the fiddle]

My question is, why this kind of problem is raising due to floating.?

解决方案

It's an artifact of having your #DivHeader be inline-block. Change it to display: block and set overflow: hidden; to contain the floats. See http://jsfiddle.net/jhcUb/

这篇关于两个div之间的匿名空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆