Do CSS functions exist?

前端 未结 9 1614
我在风中等你
我在风中等你 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:52

    I know I'm late to the party but the selected answer IS NOT the right answer since it's deferring it to CSS preprocessors.

    To answer the specific question "Do CSS functions exist?", the answer is: Yes.

    However, CSS functions work completely different than the OP's concept initially is.

    cuixiping's answer seems the most correct answer.

    Examples of CSS functions are:

    • url()
    • attr()
    • calc()
    • rotate()
    • scale()
    • linear-gradient()
    • sepia()
    • grayscale()
    • translate()

    A detailed, comprehensive list can be found here:

    CSS functions on MDN Updated link 8/8/18

提交回复
热议问题