HTML <template> Tag


The template element serves as a container for HTML content that is concealed from the user when the page loads.

The material included within <template> can be rendered later using JavaScript.

You can use the <template> element if you have any HTML code that you wish to reuse, but only if you ask for it. To do this without the <template> element, you must write the HTML code in JavaScript to prevent the browser from rendering it.

Syntax

Example

Preview

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
<template> 26.0 22.0 8.0 13.0 15.0