template HTML

HTML <template> Tag

To hold the client-side content which is not displayed when the page loads the HTML <template> tag is used. Using Javascript it can be instantiated during runtime and thus the content can be displayed when activated using JavaScript. While using the same content multiple times in an HTML document without any modification, the HTML <template> tag is useful. It can be placed within the <head>, <body>, <frameset>, or <table> elements. It was introduced in HTML5.




<!DOCTYPE html>
<p>Content is hidden.</p>
<img src="img.jpg" width="300" height="200">



In the above example, we have used the HTML <template> tag to hide the client-side content on page loading.

Global Attributes:

The HTML Global attributes are supported by the HTML <template> tag.

Supporting Browser:

Chrome, IE, Firefox, Opera and Safari.

Please Share