Home » HTML template tag

HTML template tag

by Online Tutorials Library

HTML <template> tag

HTML <template> tag is used to hold the client-side content that will not render at the time of page load, but it can be instantiated during runtime using JavaScript.

The content of the template will not be displayed until it is not activated using JavaScript. The browser processes the content of the <template> element while loading the page to ensure that the content is valid, the contents are not rendered, however.

It can also be useful when you want to use same content multiple times in your HTML document without any change.

The <template> tag can be placed anywhere inside of <head>, <body>, <frameset>, or <table> elements.

The <template> tag is newly added element in HTML5.

Syntax

Following are some specifications about the HTML <template> tag

Display None
Start tag/End tag Start and End tag
Usage Formatting

Example

Test it Now

Output:

HTML template tag

Attribute:

Tag-specific attributes:

The <template> tag does not contain any specific attribute.

Global attribute:

The <template> tag supports the Global attributes in HTML.

Supporting Browsers

Element chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
<template> Yes No Yes Yes Yes
Next TopicHTML textarea Tag

You may also like