What is a self-closing label? What is the use of self-closing tags?

云罗郡主
Release: 2018-11-10 14:37:37
Original
9249 people have browsed it

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.

What is a self-closing label? What is the use of self-closing tags?

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


are self-closing tags. Even if there is no closing tag, it does not affect its use. [Recommended reading: Is the html tag closed or not?

For example:

 


    
    

php中文网


让学习成为一种乐趣

Copy after login

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.


Attribute


Attribute is used for the use of horizontal lines.

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!