代码之家  ›  专栏  ›  技术社区  ›  Curnelious

嵌套类和标记

  •  0
  • Curnelious  · 技术社区  · 6 年前

    我知道它的基本,我知道有人问,我只是不知道正确的 学期

    我想要一个窝 tag CSS内部 class :

    .fullPageGallery
    {
      width: 100%;
      height: 100%;
    
        >h1
        // some properties of h1 here (h1 is a tag inside this class)
    
        .AnotherClass
        //some properties of another class here (a div inside this class)
    }
    
    2 回复  |  直到 6 年前
        1
  •  4
  •   Jack Bashford    6 年前

    你不能用纯CSS来做 SCSS/SASS Less :

    (以下内容适用于上述两种语言):

    .fullPageGallery {
        width: 100%;
        height: 100%;
        h1 { /* Properties */ }
        .AnotherClass { /* Properties */ }
    }
    
        2
  •  2
  •   tkore    6 年前

    你不能用香草CSS。但是,您可以使用较少的或Sass(SCSS),它们是CSS预处理器,并支持您想要的选择器嵌套。

    它们通过构建过程被编译成标准CSS。

    here here .