前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >sass - 公用方法封装

sass - 公用方法封装

作者头像
xing.org1^
发布2019-02-20 15:34:13
1.5K0
发布2019-02-20 15:34:13
举报
文章被收录于专栏:前端说吧前端说吧
代码语言:javascript
复制
// 设置宽高
@mixin wh($wid,$hei){
    @if $wid {
        width: $wid;
    }
    @if $hei {
        height: $hei;
    }
    overflow: hidden;
}
// 设置高度与行高一致
@mixin lineH($index){
    height: $index;
    line-height: $index;
}
// 父元素相对,子元素绝对
@mixin absolut($index){
    position: relative;
    &:after{
        content: "";
        position: absolute;
        z-index: $index;
    }
}
// 文本样式
@mixin txts($fs,$cl){
    @if $fs {
        font-size: $fs;
    }
    @if $cl {
        color: $cl;
    }
}
// 透明度设置
@mixin op($index){
    opacity: $index;
    filter: alpha(opacity = ($index * 100));
}
// 背景图
@mixin bgImg($link){
    background: url("../img/"+$link) no-repeat;
}
// icon图标
@mixin iCon($w,$h,$bg,$index){
    @include wh($w,$h)
    @include bgImg($bg)
    margin-right: $index;
}
// 变形
@mixin transForm($index){
    -webkit-transform: $index;
    -moz-transform: $index;
    -ms-transform: $index;
    transform: $index;
}
// 制作小箭头
@mixin arrow($clr,$index){
        border-right: 1px solid $clr;
        border-bottom: 1px solid $clr;
        @include transForm(rotate($index))
}
// 圆角度
@mixin radiu($index){
 -webkit-border-radius: $index;
 -moz-border-radius: $index;
 border-radius: $index;
}
// 盒阴影
@mixin boxSd($shadow...){
    -webkit-box-shadow: $shadow;
    -moz-box-shadow: $shadow;
    -ms-box-shadow: $shadow;
    box-shadow: $shadow;
}
// 常用内联块元素设置
%inlineB{
    display: inline-block;
    _display: inline;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-03-28 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档