
正文
Bulma 源码解析之 .container 类
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
Bulma 的
.container
类是这样实现的。
.container
position: relative
// 不设置桌面以下设备的 container
+desktop
margin: 0 auto
width: $desktop - 40px
// 修饰类
// .container.is-fluid 不固定长度、左右两边保留 20px 的外边距,在桌面+设备上有效
&.is-fluid
margin: 0 20px
max-width: none
width: auto
+widescreen
width: $widescreen - 40px
+fullhd
width: $fullhd - 40px
-
在
桌面
设备中,
.container的宽度固定为“$desktop - 40px”,也就是960px,然后居中显示。 -
在
宽屏
设备中,
.container的宽度固定为“$widescreen - 40px”,也就是1152px,然后居中显示。 -
在
大屏
设备中,
.container的宽度固定为“$fullhd - 40px”,也就是1344px,然后居中显示。 -
除此之外,在桌面设备中,如果
.container还额外指定了.is-fluid类,那么宽度就不再固定,不过左右两边各有了20px的外边距。
{提示} 关于
$desktop、$widescreen和$fullhd的变量定义可以在 这里 看到。
(完)








