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基于什么开发

bootstrap是js框架吗

不用bootstrap的理由有哪些

bootstrap的三大核心是什么

bootstrap中如何设置表单的宽高

什么是bootstrap框架

bootstrap模态框如何加滚动条

bootstrap的清除浮动

bootstrap less是什么

bootstrap如何设置表格单选按钮

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




打赏

取消

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

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

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

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

评论

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

    暂无评论...