Note/Info The <template> tag is a new tag added in HTML5.
HTML5 <template> tag
The <template> tag in HTML5 can hide the content from the user in the document.
By default, the HTML document will not render the content of this tag when the page loads.
To override this behavior, you can use JavaScript so that the content inside this tag will be rendered.
Syntax:
<template>text…</template>
Example
<template> <p>Learn HTML from TutorialBrain.com and Explore more.</p> </template>
Default CSS Value
NONE
How Browser will display
NONE
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
NA | NA | New tag in HTML5 |
Attributes used with <template> tag
NONE
Global Attributes
The <template> tag supports Global attributes.
Event Attributes
The <template> tag supports Event attributes.
Supporting Browsers
Note/Info As the <template> tag does not render the content so you can use this create HTML code to use it multiple times again and again so that you can use the code during runtime only when you need it and rest of the time, you can hide it.