Home > Web Front-end > Front-end Q&A > Do html tags always appear in pairs?

Do html tags always appear in pairs?

青灯夜游
Release: 2021-12-23 12:03:21
Original
10569 people have browsed it

The tags of

html do not necessarily appear in pairs. There are also tags that appear individually, that is, tags without closing tags; they are elements that are closed in the start tag and do not exist in pairs, such as br, hr, img, input, link, meta, param, source, etc.

Do html tags always appear in pairs?

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

In HTML, keywords whose tags are surrounded by angle brackets usually appear in pairs, such as

and
, which are called "double tags". Opening and closing tags are also known as opening tags and closing tags.

There are also tags presented separately, such as: <img src="1.jpg" />, etc. This type of tag is called "single tag".

A single tag refers to a tag without a closing tag (no end tag), that is, an empty tag.

Empty tags are HTML tag elements with no content. They are elements that are closed in the start tag. There are no pairs (except ). On the contrary, they are paired, for example. :

and
are not empty tags.

In HTML, it is invalid to use a closing tag on an empty tag, for example:
. Such cases are invalid HTML.

htmlUnpaired tags (single tag)