为什么bootstrap在.span上使用浮点数而不是display:inline-block? [英] why bootstrap uses floats on .span instead of display: inline-block?

查看:86
本文介绍了为什么bootstrap在.span上使用浮点数而不是display:inline-block?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改自定义网格,想看看其他人如何创建他们的网格系统。由于twitter的引导似乎是如此受欢迎,我看过它的代码。现在我不知道为什么他们使用浮动?我会使用 display:inline-block; html元素有 inline; display:block; 我会尽量避免浮动。但是由于某些原因,引导创建者决定使用浮动。首先我想他们使用它们具有向后兼容性,因为ie6不支持 display:inline-block; 和ie7仅支持它 :inline; 。但ie6或多或少的游戏,因为他们使用 micro clearfix黑客,使用* zoom:1;要定位 ie6 + IMO,他们可以复制相同的 display:inline-block; 与 * display:inline; * zoom:1; 因此最后的问题为什么浮动显示内联块?他们试图解决我有没有提到上述任何问题?

I was tinkering with custom grid and wanted to see how other people have created their grid-systems. Since twitter's bootstrap seemed to be so popular i've looked at its code. Now i wonder why are they using floats? I would use display: inline-block; html elements have either display: inline; or display: block; i would try to avoid floats. But for some reason bootstrap creators decided to use floats. first i was thinking they used them to have backward compatibility since ie6 does not support display: inline-block; and ie7 supports it only on elements with display: inline; by default. But ie6 more or less out of the game and since they use micro clearfix hack which uses *zoom: 1; to target ie6+ IMO they could replicate the same display: inline-block; with *display: inline; *zoom: 1; So the final Question Why Floats Over Display Inline Block? Are there any issues they tried to solve i didn't mentioned above?

推荐答案

在语义网络术语中, display:inline-block 应该在我们要在文本行中放置一个块级元素(如< img> )时使用。我们不应该使用内联放置来使页面主布局。具有 display:inline-block 的元素也会从 font-size line-height 。这将降低页面布局的准确性。
在使页面为main时,最好使用 float 而不是 inline-block 布局。

In the term of semantic web, the display: inline-block should be used when we want to place a block level element like <img> within line(s) of text. We shouldn't use inline placement for making the pages main layout. The element with display: inline-block also takes effect from properties like font-size and line-height of parent element. This will decrease the accuracy of page layout. You would better get in the habit of using float instead of inline-block when making the page main layout.

这篇关于为什么bootstrap在.span上使用浮点数而不是display:inline-block?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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