HTML: Custom Tag (Custom Element)

By Xah Lee. Date: . Last updated: .

What is Custom Tag

you can define a custom element.

the name must start with lower case a to z, then followed by a hyphen, then more letters.

<abc-xyz>custom element</abc-xyz>

you can use CSS to define its appearance and use JavaScript to define its behavior.

Custom element name restrictions

  1. All characters must be lowercase.
  2. Start with lowercase a to z
  3. Followed by zero or more simple Unicode character
  4. Followed by a hyphen
  5. Followed by zero or more simple Unicode character

the “simple Unicode character” includes Emoji 😄

custom element name spec 2022-08-24 cSgM4
custom element name spec 2022-08-24
HTML spec custom element name 2022-08-24
HTML spec custom element name 2022-08-24

Reference

HTML spec Custom Element 2022-08-24 6dNbf
HTML spec Custom Element 2022-08-24

HTML custom tags and attribute