DEV Community

Cover image for HTML tags | template
Carlos Espada
Carlos Espada

Posted on • Edited on

3

HTML tags | template

It is used as a container to hold some HTML content hidden from the user when the page loads, but may be rendered later using JavaScript.

Think of a template as a content fragment that is being stored for subsequent use in the document. While the parser does process the contents of the <template> element while loading the page, it does so only to ensure that those contents are valid; the element's contents are not rendered, however.

You can use it if you have some HTML code you want to use over and over again, but not until you ask for it. To do this without the <template> tag, you have to create the HTML code with JavaScript to prevent the browser from rendering the code.

  • Type: -
  • Self-closing: No
  • Semantic value: No

Definition and example | Support

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up