bootstrap的清除浮动


本文摘自PHP中文网,作者藏色散人,侵删。

bootstrap清除浮动的方法:首先打开相应的代码文件;然后通过为父元素添加“.clearfix”类的方法清除浮动,语句如“<div class="clearfix">...</div>”。

本教程操作环境:Windows7系统、bootsrap3.3.7版,Dell G3电脑。

通过为父元素添加 .clearfix 类可以很容易地清除浮动(float)。这里所使用的是 Nicolas Gallagher 创造的 micro clearfix 方式。此类还可以作为 mixin 使用。

使用方法如下:

1

2

<!-- Usage as a class -->

<div class="clearfix">...</div>

.clearfix 类如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

// Mixin itself

.clearfix() {

  &:before,

  &:after {

    content: " ";

    display: table;

  }

  &:after {

    clear: both;

  }

}

// Usage as a mixin

.element {

  .clearfix();

}

推荐:《bootstrap视频教程》《css视频教程》

以上就是bootstrap的清除浮动的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

bootstrap table给行怎么加背景色

bootstrap下拉列表怎么设置默认值

bootstrap 怎么添加关闭按钮

bootstrap为什么是12栅格

less百行代码实现bootstrap栅格布局

bootstrap是哪个组织创立的

bootstrap模态框如何提交表单

bootstrap如何解决浏览器兼容性问题

bootstrap layout it怎么使用

bootstrap有什么ui框架?

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...