What are “data-url” and “data-key” attributes of tag?

前端 未结 4 1012
傲寒
傲寒 2020-12-13 07:25

I\'ve faced two strange attributes of an html tag . They are \"data-url\" and \"data-key\".

What are they and how

4条回答
  •  猫巷女王i
    2020-12-13 07:43

    A new feature being introduced in HTML 5 is the addition of custom data attributes. Simply, the specification for custom data attributes states that any attribute that starts with “data-” will be treated as a storage area for private data (private in the sense that the end user can’t see it – it doesn’t affect layout or presentation). This allows you to write valid HTML markup (passing an HTML 5 validator) while, simultaneously, embedding data within your page. A quick example:

  • John says: Hello, how are you?
提交回复
热议问题