缺点是浮动布局中的一切? [英] Disadvantage to floating everything in a layout?
问题描述
大家都知道 float
CSS属性存在问题:在某些浏览器中有文本慢跑,您必须清除
它们拉取 float
ed div等的父元素。
Everyone knows that there are problems with the float
CSS property: there are text jogs in some browsers, you have to clear
them to pull parent elements around a float
ed div, etc.
让我们假设我构建一个布局并浮动一切,我谨慎控制浏览器特定的错误。使用 float
是否有缺点?页面需要更长的渲染时间,还是有更好的练习?
Let's assume I build a layout and float everything, and I'm careful to control for the browser-specific bugs. Are there disadvantage to using float
for everything? Will the page take longer to render, or is there a better practice?
我想改进我的CSS布局构建技巧。
I'm trying to improve my CSS layout building technique.
推荐答案
@kevin; float
不是一个坏习惯;它取决于你如何使用它&什么是设计的需要。没有必要使用它在一切,当没有需要&它来自经验。
@kevin; float
is not a bad practice; it depends on how you are using it & what the needs of the design are. There is no need to use it on everything when there is no need & it comes from experience.
每个浏览器都会正确地呈现 float
。
如果你在你的标记中使用 clear:both
,就像这样
Every browser renders float
correctly.
yes if you use clear:both
in your markup like this
<div style="clear:both"></div>
它增加您的标记,增加您的页面加载时间。
。 SO,使用 overflow:hidden
在您的css中清除它。
it's increase your markup which increase your page loading time.
. SO, use overflow:hidden
in your css to clear it.
这篇关于缺点是浮动布局中的一切?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!