This content originally appeared on DEV Community and was authored by Carlos Espada
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 | Example | Support
This content originally appeared on DEV Community and was authored by Carlos Espada
Carlos Espada | Sciencx (2021-12-01T07:26:13+00:00) HTML tags | template. Retrieved from https://www.scien.cx/2021/12/01/html-tags-template/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.