Do CSS functions exist?

前端 未结 9 1690
我在风中等你
我在风中等你 2021-01-04 11:08

I\'m not sure what to call this, but basically let\'s say I have a style that I use a lot,

.somepattern{
    font-size:16px;
    font-weight:bold;
    borde         


        
9条回答
  •  青春惊慌失措
    2021-01-04 11:39

    Even later to the party!

    You can now do this with css custom variables.

    In our css using the var() function:

    .some-pattern {
        font-size: var(--font-size);
        font-weight: bold;
        border: var(--border);
      }
    

    Then in our html defining the custom variables inline:

    test

提交回复
热议问题