Home  >  Q&A  >  body text

Do custom elements require closing tags?

The elements I defined (which don't require content) seem to work just fine without the closing tag. I'm wondering if this is just a quirk of the browser.

What is the verdict? Is it theoretically possible? What if the parser sees the element before it is defined?

P粉717595985P粉717595985355 days ago746

reply all(1)I'll reply

  • P粉387108772

    P粉3871087722023-10-30 20:56:14

    Yes. Custom elements require closing tags. Due to parser reasons, only certain tags in HTML are allowed to self-close.

    and:

    http://www.w3.org/TR/ html-markup/syntax.html#syntax-elements

    reply
    0
  • Cancelreply