肉渣教程

访问器

上一节 下一节

访问器

使用混合(Mixing in)的时候,有时只需要混合预设样式中的某一部分,则可只访问混合样式中的指定部分。具体如下例所示。


使用less

#example() {
  .button {
    display: block;
    border: 1px solid black;
    background-color: grey;
    &:hover {
      background-color: white;
    }
  }
  .tab { color:red; }
  .citation { color:red; }
}

#header a {
  color: orange;
  #example.button();  // 也可以写#example > .button
}


输出css

#header a {
  color: orange;
  display: block;
  border: 1px solid black;
  background-color: grey;
}
#header a:hover {
  background-color: white;
}

访问器

上一节 下一节