Templating in HTML | Kitty Giraudelthe <template> HTML element is intended to store HTML that is not yet used. The element itself and all its content are invisible, so it can be basically anywhere in the document without much risk.
<template> do not enabling you to do anything that’s not possible otherwise. In that way, it’s more of a convenience tool really. If you have significant HTML structures that need to be injected at runtime
Why not a hidden element?
Unlike content within a hidden container, the content of a <template> is inert: images and scripts do not load, styles do not apply, elements are not queried, etc.
Post a Comment