What is a self-closing tag? What is the use of self-closing tags? I believe that many people who have just started HTML don’t know about self-closing tags? The following PHP Chinese website summarizes the autism tags for you.
1: What is a self-closing tag?
The so-called closing tag means that the tag has a beginning and an end. Currently in html , all appear in pairs, many of which are composed of start and end tags, but some do not have an end tag, but some students are worried that if the tag does not have a closing tag, it will affect the use. In fact, some tags are self-closing and tags. , for example,
and
For example:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="content-type" content="text/html;charset=gb2312"/> </head> <body> <div> <h3>php中文网</h3> <hr/> <p>让学习成为一种乐趣</p> </div> </body> </html>
We can see the above code Out, we can insert any tags and text in div, but in meta, we cannot insert any tags, we can only define its own attributes. And from the above code, we can see that the tag has a start tag and an end tag, and the self-closing tag has no end tag.
2: What is the use of self-closing tags
Sometimes we forget to write some closing tags, which will not affect the display effect. There are many self-closing and closing tags in the web page. Tags, for example:
1. The general use of the attribute
is used to reference the css of external links, or to reference external links.
2.
Attribute
Attribute is generally used for line wrapping of text.
3.
4.Attributes
Attributes generally define elements in the form
The above is an introduction to what is a self-closing tag? A complete introduction to the use of self-closing tags. If you want to know more about Html5 tutorial, please pay attention to the php Chinese website.
The above is the detailed content of What is a self-closing label? What is the use of self-closing tags?. For more information, please follow other related articles on the PHP Chinese website!