1. First look at HTML5 template elements
Theelement is basically certain to have only appeared in 2013. What is it used for? As the name implies, it is used to declare that it is a "template element".
Currently, we embed template HTML in HTML, which is often written like this:
In fact, there is no standard way of writing type="text/template". The appearance of the element is intended to make HTML template HTML more standard and standardized.
In the past, we may have used
Look at the following four nested image HTMLs. At the same time, the image content is not displayed and there is no request:
1. Hiddenness of tag content
The specificity of <script> allows internal HTML tags to be processed as strings, so the generated content is not displayed. However, in DreamWeaver, this writing method has a big problem, that is, when writing template HTML in script, the tag automatically closed is always </script>, which is very annoying.
2. Tag position arbitrariness
In addition to the natural hiding of the sub-elements above, the tag also has another feature, which is arbitrariness in position, which is very similar to < The script> or