twitter-bootstrap – Bootstrap 3.0:响应列重置文档部分

栏目: CSS · 发布时间: 6年前

内容简介:翻译自:https://stackoverflow.com/questions/19172397/bootstrap-3-0responsive-column-resets-section-of-the-documentation

嘿,所以在bootstrap 3.0文档中,如果您查看副标题“响应列重置”,它会说如下:

“With the four tiers of grids available you’re bound to run into issues where, at certain breakpoints, your columns don’t clear quite right as one is taller than the other. To fix that, use a combination of a .clearfix and our responsive utility classes.”

现在他们的意思是什么?我认为花车清除 – 或没有 – 基于宽度.我在这里想念的是什么?

我相信 http://getbootstrap.com/css/#grid-responsive-resets

上的例子是错误的,没有说明问题.

http://getbootstrap.com/css/#grid-responsive-resets 上的示例不能直观地说明问题.

your columns don’t clear quite right as one is taller than the other

示例没有clearfix:

<div class="row">
  <div class="col-xs-6 col-sm-3" style="background-color:red;height:40px;">.col-xs-6 .col-sm-3</div>
  <div class="col-xs-6 col-sm-3" style="background-color:blue;">.col-xs-6 .col-sm-3</div>
  <div class="col-xs-6 col-sm-3" style="background-color:green;">.col-xs-6 .col-sm-3 (left)</div>
  <div class="col-xs-6 col-sm-3" style="background-color:yellow;">.col-xs-6 .col-sm-3 (right)</div>
</div>

在第一列(红色)较高的超小(xs)上,第二列(蓝色)将导致第三(绿色)列浮动在第一列的右侧.

没有clearfix

与clearfix

<div class="row">
  <div class="col-xs-6 col-sm-3" style="background-color:red;height:40px;">.col-xs-6 .col-sm-3</div>
  <div class="col-xs-6 col-sm-3" style="background-color:blue;">.col-xs-6 .col-sm-3</div>
  <div class="clearfix visible-xs"></div>
  <div class="col-xs-6 col-sm-3" style="background-color:green;">.col-xs-6 .col-sm-3 (left)</div>
  <div class="col-xs-6 col-sm-3" style="background-color:yellow;">.col-xs-6 .col-sm-3 (right)</div>
</div>

山坳 – * – 12

当您在一行中添加更多12列并且其中一行应为100%(col – * – 12)时,也会出现此问题.

考虑这种情况:

在你想要的更大的网格上:

1 | 2 | 3

在你想要的xs网格上:

1 | 2
  3

你可以用以下方法完成上述任务

Without clearfix:
<div class="container">
<div class="row">
<div class="col-xs-6 col-sm-4">1</div>
<div class="col-xs-6 col-sm-4">2</div>
<div class="col-xs-12 col-sm-4" style="background-color:red;">3</div>
</div>
</div>

红色背景将显示最后一列与第一列重叠.添加clearfix将删除此背景:

With clearfix:  
<div class="container">
<div class="row">
<div class="col-xs-6 col-sm-4">1</div>
<div class="col-xs-6 col-sm-4">2</div>
<!-- Add the extra clearfix for only the required viewport -->
  <div class="clearfix visible-xs"></div>
<div class="col-xs-12 col-sm-4" style="background-color:red;">3</div>
</div>
</div>

结果:

提到的重叠将由col-12- *类引起没有浮动,参见: https://github.com/twbs/bootstrap/issues/10152

https://github.com/twbs/bootstrap/issues/10535 ,您将找到另一个插图. This fiddle 显示了clearfix如何解决问题.注意<div class =“col-sm-3”>这里没有col-12- *.在xs网格列上默认为100%并且没有浮点数,因此col-xs-12- *的行为与xs网格上的非类相同.

翻译自:https://stackoverflow.com/questions/19172397/bootstrap-3-0responsive-column-resets-section-of-the-documentation


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

RabbitMQ实战

RabbitMQ实战

Alvaro Videla、Jason J. W. Williams / 汪佳南 / 电子工业出版社 / 2015-10 / 75.00元

本书对RabbitMQ做了全面、翔实的讲解,体现了两位专家的真知灼见。本书首先介绍了有关MQ的历史,然后从基本的消息通信原理讲起,带领读者一路探索RabbitMQ的消息通信世界。这当中不仅包含了针对单台RabbitMQ服务器和RabbitMQ集群的讲解,还教导读者如何使用各种工具来进行监控。 本书内容浅显易懂,文笔风趣幽默。书中包含了丰富的、可以运行的示例程序源代码,读者可以自行下载并运行,......一起来看看 《RabbitMQ实战》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换