Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Twitter引导中这个CSS的等价物是什么? 第1栏 第2栏_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html Twitter引导中这个CSS的等价物是什么? 第1栏 第2栏

Html Twitter引导中这个CSS的等价物是什么? 第1栏 第2栏,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我习惯于写clear:two。但我听说在Twitter引导中有一个叫做“clearfix”的东西?我应该/会在哪个元素上应用“clearfix”?您可能只需要执行以下操作: <div style="float:left;"> column 1 </div> <div style="float:left;"> column 2 </div> <div style="clear:both;"></div> 第

我习惯于写
clear:two
。但我听说在Twitter引导中有一个叫做“clearfix”的东西?我应该/会在哪个元素上应用“clearfix”?

您可能只需要执行以下操作:

<div style="float:left;">
    column 1
</div>
<div style="float:left;">
    column 2
</div>
<div style="clear:both;"></div>

第1栏
第2栏

clearfix
应该不是必需的。

使用css,您可以简单地使用after-psudeo

<div class="container">
   <div class="row">
      <div class="span6">column 1</div>
      <div class="span6">column 2</div>
   </div>
</div>
将不需要的标记保留在html文件之外

编辑:对不起!由于某种原因,“添加评论”按钮或“向上投票”按钮今晚对我不起作用

将我的答案附加在回答您的其他问题之后:


您所说的twitter引导使用了一个.clearfix类,它类似于我在下面提供的css,但是它们的方法需要添加到元素中,即:“element class=”clearfix“或者类似的,作为css PSEDOO,我们不需要在文档中添加额外的代码。但是请注意,并非所有浏览器都支持css PSEDOO。

我不知道Twitter引导,但我看到的每个
.clearfix
实现都完全适用于您现在所做的。它只是
。我一直在想这个问题。就我个人而言,我认为这是故意的疏忽。:)关于div是否清除float的建议不是标记的问题,而是类的问题。例如,导航栏内部将清除。您可以使用引导程序mixin.clearfix()来清除小部件。但是这只是一个猜测,这就是为什么我不想在下面给出答案。关闭,但是
clearfix
类需要继续
div.container
。有必要正确地清除
div.container
@MichaelIrwin之后的
div
s,我不完全相信这是必要的,但我在引导方面的经验并不丰富。请注意,我更新了这个答案,以说明Twitter引导更改为12列,并更正了我的答案。
.class1:after, .class2:after //append as many as you like
{
 clear:both;
 *zoom:1;
 height:0;
 visibility: hidden;
 display:block;
}

alternative(providing children are not using the position selector)
(parent-elemts){overflow:hidden;}//bit of a quick fix!