Get the App
SLTechnology News&Howtos  ›  Development  › 

Whether the html tag is closed or unclosed

Shulou Source: shulou.com Published: 2022-06-02 14:12:37 10月03日 Update

This article mainly introduces "the html tag is closed or not closed". In the daily operation, I believe that many people have doubts about whether the html tag is closed or not closed. The editor consulted all kinds of data and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the question of "html tag is closed or not closed". Next, please follow the editor to study!

No content element (Void elements)

A content-free element is a special element that cannot contain any content. Other elements, for example, can not contain any content, but can also contain another element or text.

The more common content-free elements are:

Less common content-free elements are:

These are all the existing content-free elements.

Such writing is illegal for HTML because it implies that br can contain content (but

Hello! Is completely meaningless. And

And both are common.

Although we all know that XHTML forces you to write, there is no explicit rule in HTML.

Trace back to history

In order to fully understand the content-free element, it is necessary to understand its history.

HTML, XML and XHTML are all based on SGML. The full name of SGML is "Standard Universal markup language", which was drafted in 1986.

Both HTML and XML are derived from SGML, where XML is a constrained subset of SGML and XHTML is based on XML.

XHTML is basically the same as HTML, but based on XML.

With this relationship in mind, let's move on to the most interesting part of this article.

SGML has a feature called "NET,Null End Tag". When there is only simple text in the tag, there is no need to close the tag by using a tailless tag. For example, you can write Quoted text as. )

Then, tags that do not contain anything can be written as

Tags: Tags content closure elements syntax attributes writing tailless or features editors learning pictures characters developers browsers shortcomings problems development support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft Shulou Information NVidia MySQL