SCSS常用的几个特性

<template>
  <div class="main">
   main
  
    <span class="hello">xxx</span>
    <div class="as"></div>
     <div class="d"></div>
      <div class="dd"></div>
        <div class="ddd"></div>
         <div class="dddd"></div>
            <div class="ddddd">ddddd</div>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  }
}
</script>


<style scoped lang="scss">
@import "@/scss/index.scss";
$base-color:red;  //定义变量
$base-color:blue !default;
$side:bottom;
$sides:top;
.main{
  width: 1920px;
   justify-content: space-around;
  display:flex;
 color: $base-color;
 border-#{$side}:2px solid blue;  //定义字符
 border-#{$sides}:2px solid blue;
 .hello{
   font-size: 40px;
   &:hover{
     color: blue;
   }
 }
}
.as{
  width: 100px;
  height: 100px;
  background-color: red;
}
@mixin myCSS{   //定义公共的
  color: orange;
  background-color: palevioletred;
}
.d{

  @extend .as;
  @include myCSS;
}

@mixin myScssa($myColor){  //传参
  color: $myColor;
  background-color: $myColor;
}

.dd{
  width: 100px;
  height: 100px;
  @include myScssa(yellow);  //使用传参
}

@mixin myScssa($myColor:red){
  color: $myColor;
  background-color: $myColor;
}
.ddd{
  width: 100px;
  height: 100px;
  @include myScssa(green);
}

@mixin myScssd($myColor:blue,$myBackgroundColor:yellow){
  color: $myColor;
  background-color: $myBackgroundColor;
}

.dddd{
  width: 100px;
  height: 100px;
  @include myScssd(yellow,blue )
}
@function double($n){  //定义函数方法
  @return $n*2;
}

.ddddd{
  width: 100px;
  height: 100px;
  font-size: double(20px);
 background-color: gray;
 @if 1==2{     //if判断
   color: blue;
 }@else if 3>5{
   color: red;
 }@else {
   color: yellow;
 }
}








</style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值