SCSS 復用 class 樣式


SCSS 復用 class 樣式

@mixin & @include

復用的變量名稱,不可以是 .class 開頭⚠️

✅ css-varibale-name

❌ .css-class-name

Mixins

https://sass-lang.com/guide#topic-6

API

https://sass-lang.com/documentation/at-rules/mixin

Playground

https://sass.js.org/

.router-link-custom-class {
    @mixin tools-hover-box {
        box-sizing: border-box;
        position: fixed;
        z-index: 999999;
        top: 60px;
        left: 0;
        bottom: 0;
        right: 0;
        background:#EEEEF0;
        overflow: auto;
        width: 100vw;
        min-width: 1366px;
    }
    .tools-hover-box {
        @include tools-hover-box;
        height:0;
        transition: height 1s .3s ease-out;
    }
    .tools-hover-box:hover {
        @include tools-hover-box;
        height: 200px;
        transition: height 1s .3s ease-in;
    }
    &:hover {
        .tools-hover-box {
        @include tools-hover-box;
            height: 200px;
            transition: height 1s .3s ease-in;
        }
    }
}
.router-link-custom-class .tools-hover-box {
  box-sizing: border-box;
  position: fixed;
  z-index: 999999;
  top: 60px;
  left: 0;
  bottom: 0;
  right: 0;
  background: #EEEEF0;
  overflow: auto;
  width: 100vw;
  min-width: 1366px;
  height: 0;
  transition: height 1s .3s ease-out;
}

.router-link-custom-class .tools-hover-box:hover {
  box-sizing: border-box;
  position: fixed;
  z-index: 999999;
  top: 60px;
  left: 0;
  bottom: 0;
  right: 0;
  background: #EEEEF0;
  overflow: auto;
  width: 100vw;
  min-width: 1366px;
  height: 200px;
  transition: height 1s .3s ease-in;
}

.router-link-custom-class:hover .tools-hover-box {
  box-sizing: border-box;
  position: fixed;
  z-index: 999999;
  top: 60px;
  left: 0;
  bottom: 0;
  right: 0;
  background: #EEEEF0;
  overflow: auto;
  width: 100vw;
  min-width: 1366px;
  height: 200px;
  transition: height 1s .3s ease-in;
}

refs



©xgqfrms 2012-2020

www.cnblogs.com 發布文章使用:只允許注冊用戶才可以訪問!



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM