Home  >  Article  >  Web Front-end  >  Do html tags always appear in pairs?

Do html tags always appear in pairs?

青灯夜游
青灯夜游Original
2021-12-23 12:03:2110407browse

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)

  • ##
    : A simple line break can be inserted. The


    tag is an empty tag (meaning it has no closing tag, so this is an error:

    ). In XHTML, place the closing tag within the opening tag, i.e.
    .



  • : Defines topic changes in HTML pages (such as topic shifts) and displays them as a horizontal line.

  • : Defines the area inside the image map (image map refers to an image with a clickable area).

  • : Specifies the default address or default target for all links on the page.

  • : Define images in HTML pages.

  • : Specifies an input field in which the user can enter data.

  • : Defines the relationship between the document and external resources. The most common use is to link style sheets.

  • : Provides metadata for the HTML document. The metadata will not be displayed on the client, but will be parsed by the browser.

    The META element is usually used to specify the description, keywords, last modification time of the file, author and other metadata of the web page.

    Metadata can be called using browsers (how content is displayed or pages are reloaded), search engines (keywords), or other web services.

  • : Defines the default color, size, and font for all text in the document.

  • : Allows you to specify run-time settings for the object inserted into the XHTML document, that is, this tag can be the or

  • : Specifies the column attributes of each column inside the element. By using the tag, you can apply a style to an entire column without having to repeat the style for each cell or row.

  • : Define a specific window (frame) in the frameset. Each frame in the frameset can set different properties, such as border, scrolling, noresize, etc.

  • : Defines a container for embedding external applications or interactive programs (plug-ins).

  • Specifies the key pair generator field to use for the form.

  • : Defines media resources for media elements such as
  • Related recommendations: "

    html video tutorial"

    The above is the detailed content of Do html tags always appear in pairs?. For more information, please follow other related articles on the PHP Chinese website!

    Statement:
    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