CSS shorthand for positioning

前端 未结 5 1294
小鲜肉
小鲜肉 2020-12-05 17:17

There are any shorthand for top right bottom left or for width and height ?

I have a lo

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 17:47

    inset is what you can use in 2020 as positioning shorthand, but you need to use PostCSS and this plugin https://github.com/jonathantneal/postcss-inset

    Example:

    .example {
      inset: 10px 20px 80px;
    }
    
    /* becomes */
    
    .example {
      top: 10px;
      right: 20px;
      bottom: 80px;
      left: 20px;
    }
    
    

    More info and spec here: https://www.w3.org/TR/css-logical-1/#propdef-inset

提交回复
热议问题