Import CSS Selector Styles in Another Selector? (NOT @import)

前端 未结 3 1792
别跟我提以往
别跟我提以往 2021-01-18 18:29

Is there a way to import the styling of a single CSS selector into another CSS selector and add to it or rewrite properties from it.

Let\'s say:

.ori         


        
3条回答
  •  情歌与酒
    2021-01-18 19:09

    Not directly, no.

    You could do something like this in your HTML:

    ...

    This will have the same effect, but you will have to do this for every element you want styled that way.

    There is also the option of using a CSS pre-processor, like SASS, which supports inheritance/mixins.

提交回复
热议问题