zoukankan      html  css  js  c++  java
  • [SCSS] Organize Styles with SCSS Nesting and the Parent Selector

    SCSS nesting can produce DRYer code by targeting child elements without having to write the parent class. Nesting up to 3 levels deep can help us understand relationships between styles. The SCSS parent selector represents the parent class, so it can DRY up targeting pseudo-elements/classes and be an asset for naming conventions. 

    .box {
    
      &-container { /* .box-container, & --> .box*/
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100vw;
        height: 100vh;
      }
    
      transition: all 0.8s ease-in-out;
      &:hover {
        background-color: #ff4d4d;
        transform: rotate(360deg);
      }
      background-color: #5fb3ce;
      border: 1px solid burlywood;
      font-size: 1.5em;
       200px;
      height: 200px;
    }

    To css:

    .box {
      transition: all 0.8s ease-in-out;
      background-color: #5fb3ce;
      border: 1px solid burlywood;
      font-size: 1.5em;
      width: 200px;
      height: 200px; }
      .box-container {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100vw;
        height: 100vh; }
      .box:hover {
        background-color: #ff4d4d;
        transform: rotate(360deg); }
  • 相关阅读:
    Fliptile
    Face The Right Way
    Jessica's Reading Problem
    Subsequence
    Xcode下载途径
    target信息异常
    清除编译缓存DerivedDate
    Xcode快捷键
    Xcode忽略编译警告
    iOS项目Info.plist中关键字汇总
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6697217.html
Copyright © 2011-2022 走看看