溢出:在Chrome,IE中自动添加滚动条 [英] overflow:auto adding scrollbars in Chrome, IE

查看:29
本文介绍了溢出:在Chrome,IE中自动添加滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前添加了< div style ='clear:both'></div> 来清除先前片段中的浮点数,但是有人建议我应该使用 overflow:在< div> 上使用浮点数自动代替,因为它更简单,更干净.

I used to add a <div style='clear:both'></div> to clear floats from previous segments, but someone suggested I should use overflow:auto on the <div> with floats instead as it's simpler and more clean.

问题是,我得到报告说我的网站中存在一些奇怪的阴影".经过调查,事实证明它发生在Chrome中,而不是Firefox中,而这些阴影"实际上是很小的滚动条.

Problem is, I got reports that there were some strange 'shades' in my website. After investigating, it turns out it happens in Chrome, not in Firefox, and those 'shades' are actually very small scrollbars.

在此jsfiddle中,我尝试将部件减少到最少 http://jsfiddle.net/57HM3/4/.请注意,它们位于最右侧(显示结果"的位置).它似乎与行高有关,如果我将其设置为1.2而不是1.1,它会消失.这是某种已知的问题(我不知道)吗?

I tried to reduce the parts to a minimum in this jsfiddle http://jsfiddle.net/57HM3/4/ . note they are far to the right (by where it says 'Result'). It seems to have to do with the line-height, if I set it to 1.2 instead of 1.1 it disappears. Is this some sort of known issue (that I don't know about)?

我知道还有其他方法可以清除它们,但是它们涉及IE特定代码,而没有.我想保持原样,只是将带有浮点数的div设置为overflow:auto(如果不起作用,我宁愿回到我添加额外的< div>

I know there are other ways to clear them but they involve IE specific codes and what not. I'd like to keep it as it is, just making the div with the floats as overflow:auto (and if this doesn't work, I'd rather go back to my adding the extra <div>

推荐答案

添加 overflow:hidden 代替.这将清除您的所有内容,并且不会添加任何滚动

add overflow:hidden instead of. This will clear your both and will not add any scroll

这篇关于溢出:在Chrome,IE中自动添加滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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