Bootstrap 4参考手册
实用工具 | Utilities
清除浮动 | Clearfix
通过添加一个clearfix实用程序,快速轻松地清除容器中的浮动内容。
通过添加.clearfix
到父元素可轻松清除float
s 。也可以用作混音。
<div class="clearfix">...</div>
// Mixin itself
@mixin clearfix() {
&::after {
display: block;
content: "";
clear: both;
}
}
// Usage as a mixin
.element {
@include clearfix;
}
以下示例显示了如何使用clearfix。如果没有clearfix,则换行div不会跨越会导致布局破碎的按钮。
打开getbootstrap.com上的示例
<div class="bg-info clearfix">
<button type="button" class="btn btn-secondary float-left">Example Button floated left</button>
<button type="button" class="btn btn-secondary float-right">Example Button floated right</button>
</div>
实用工具 | Utilities相关
Bootstrap 是一套用于 HTML、CSS 和 JS 开发的开源工具集。利用我们提供的 Sass 变量和大量 mixin、响应式栅格系统、可扩展的预制组件、基于 jQuery 的强大的插件系统,能够快速为你的想法开发出原型或者构建整个 app 。
主页 | https://getbootstrap.com/ |
源码 | https://github.com/twbs/bootstrap |
版本 | 4 |
发布版本 | 4.0.0-beta.2 |