Why does CSS work with fake elements?

前端 未结 19 714
野的像风
野的像风 2020-11-28 01:21

In my class, I was playing around and found out that CSS works with made-up elements.

Example:

19条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 01:42

    Actually you can use custom elements. Here is the W3C spec on this subject:

    http://w3c.github.io/webcomponents/spec/custom/

    And here is a tutorial explaining how to use them:

    http://www.html5rocks.com/en/tutorials/webcomponents/customelements/

    As pointed out by @Quentin: this is a draft specification in the early days of development, and that it imposes restrictions on what the element names can be.

提交回复
热议问题