Hướng dẫn html close tag
In this tutorial, you will learn about self closing tags in HTML, how to use them, and close the self closing tag. Also, you will go through various self closing tags with descriptions and examples. Show Nội dung chính
HTML Self Closing TagA self closing tags in HTML are the type of HTML tags that need not to be closed manually by its closing tag, which means there is no saperate closing tag for it as . A few examples of self closing tags are
None of
the self closing tags in the above code snippets has content within them, nor do they have any child nodes. Here are of closing tags in HTML (tags that need to be closed) are ... The correct way to write a self closing tagIn HTML, closing a self closing tag with its closing tag is invalid. For example, closing a tag like is not valid. But the question is do we need to close these tags by using /> at the end of the tag. i.e The fact is there is no need to close self closing tags by a slash /> at the end of the tag. Although many people use it but there is no meaning of slash at the end of the start tag even though you use it is ignored by the browsers. But when using XHTML it is the rule to close the self closing tag by a slash at the end, so for the convenience of XHTML users HTML also allows closing tag like XHTML in HTML but simply ignores the slash. Even if you close the tag browser remove the slashes and then render the element. You can see the picture below to understand. Note - Even if the browser ignores the closing slash in void tags, it's good practice to close it because: Here is a list of all the self closing tags in HTML with little description of all. Non of self closing tags can have content or child node.
|