sass

Sass笔记
1.变量
$c1:#fff;
//声明c1
.home{
Color:$c1;
}
2.嵌套
  ①
Nav{
A{
Color:$c1;
}
//改变选择器的顺序,将&后置,将当前的选择器提到父级
Header  &{
Color:$c2;
}
}
等价于
Header nav a{
}
②
.box{
Border:{
top:1px solid #000;
Bottom:2px solid #000;
}
}
③
.home{
&::befor{
Color:$c1;
}
&:hover{
Color:$c2;
}
}
3、Mixin\extend
@mixin border-radius{
    -webkit-border-radius: 5px;
    border-radius: 5px;
}
大括号里面是复用的样式代码。

带参数混合宏:
@mixin border-radius($radius:5px){
    -webkit-border-radius: $radius;
    border-radius: $radius;
}
用include调用
Button{
@include border-radius;
}
.btn{
Border:1px solid #000;
}
//继承
.home{
Background:#ccc;
@extend .btn;
}
%m5{
Border:1px solid #000;
}
//占位符
.home{
Background:#ccc;
@extend %m5;
}
  .btn-#{$color} {
    @include button-variant($value, $value);
  }
在字符串中引用变量就得#{$变量}
input[type="submit"]
这种用法
p::after { content: "#{length($colors)}"; 
// 5 color: nth($colors, 1); // #fff}
从1~length
单行注释不会被编译进css中 但是多行注释如果位置写的不对也不会被编译进css中
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值