Skip to main content

辅助方法

SACSS 并不能覆盖所有的样式,以下四个项目常用的样式,SACSS 提供了对应的 Mixin,方便用户使用。

这里推荐使用基于功能的语义化名称,所以这里并不具有 SACSS 命名规范。

名称功能
Clearfix清除 float 的浮动
Ellipsis单行文本超出显示...
Ellipsis-multiple多行文本超出显示 ...
Cell在浮动布局中撑满剩余空间

需要注意的是,当你有统一的命名前缀的时候,建议这里的代码也添加上统一前缀。

使用#

Life was like a box of chocolates. You never know what you're going to get.
Life was like a box of chocolates. You never know what you're going to get. Life was like a box of chocolates. You never know what you're going to get.
Float-left
Life was like a box of chocolates. You never know what you're going to get.
@import 'sacss/less/Helpers';
.clearfix{ #Clearfix; }
.ellipsis{ #Ellipsis; }
.cell{ #Cell; }
.ellipsis-mul{ #Ellipsis-multiple; }
.ellipsis-mul._2{ -webkit-line-clamp: 2; }