Do custom CSS properties use one leading dash or two?

前端 未结 2 1471
心在旅途
心在旅途 2020-12-02 00:46
#elem {
  -myCustom: 99;
}

OR

#elem {
  --myCustom: 99;
}

I have seen both of the above used in examples online.

2条回答
  •  甜味超标
    2020-12-02 01:08

    Custom properties use one dash, by convention followed by the renderer/software.

    For example:

    -webkit-box-shadow

    -moz-box-shadow ...

    But it seems that there is a new feature implementing two dashes, this might be interesting for you:

    http://www.broken-links.com/2014/08/28/css-variables-updating-custom-properties-javascript/

提交回复
热议问题