CSS at rule

2019-04-04  本文已影响0人  HelenYin

重学前端学习笔记

qualified rule

这就是一般的css规则

at-rule

@ + 关键子和后续的区块组成

  @import "mystyle.css";
  @import url("mystyle.css");
  //  下面这个是什么鬼
  @import [ <url> | <string> ]
        [ supports( [ <supports-condition> | <declaration> ] ) ]?
        <media-query-list>? ;
    css
       @counter-style test {
            system: alphabetic;
            symbols: "\7532" "\4E59" "\4E19" "\4E01" "\620A" "\5DF1" "\5E9A" "\8F9B" "\58EC" "\7678";
            suffix: "、";
        }
        ul{
            list-style: test;
        }
    html
        <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
    </ul>
// 基本用法
@supports (display:flex) {
  section { display: flex }
  /* 其他code*/
}
// 非
@supports not (display: flex){
  #container div{float:left;}
}
// 与
@supports (column-width: 20rem) and (column-span: all) {
  div { column-width: 20rem }    
  div h2 { column-span: all }
  div h2 + p { margin-top: 0; }
  /*其他代码*/
}
// 或
@supports (display: -webkit-flex) or (display: -moz-flex) or (display: flex) {
  section {
    display: -webkit-flex;
    display: -moz-flex;
    display: flex;
    /*其他代码*/
  }         
}
// 混用是要使用()
@supports ((transition-property: color) or (animation-name: foo)) and (transform: rotate(10deg)) {
  /*code*/
}
@supports (transition-property: color) or ((animation-name: foo) and (transform: rotate(10deg))) {
  /*code*/
}
上一篇 下一篇

猜你喜欢

热点阅读