Do html tags need to be closed? -

Source: Internet
Author: User
0 reply content:

If you are impatient, you can jump to the conclusion.

Empty elements must either have an end tag or the start tag must end with/>. For instance,
Or. See HTML Compatibility GuidelinesFor information on ways to ensure this is backward compatible with HTML 4 user agents.

CORRECT: terminated empty elements




INCORRECT: unterminated empty elements




Http://www.w3.org/TR/xhtml1/
According to the XHTML standard,
Is incorrect
According to the HTML 4.01 standard,
Is incorrect

Based on http://validator.w3.org/ Detection results:
Doctype: XHTML 1.0 Strict:

Is the correct method, and
Yes.
Is the correct method, and
Yes.


Doctype: HTML 4.01 Strict:


Is the correct method, and
Yes.


The XHTML declared by W3C is also written in accordance with the XHTML standard.

Http://www.w3.org/TR/html401/sgml/dtd.html This is a W3C page that uses HTML 4.01.
Note: Tag syntax, Declare HTML4.01, also use HTML 4.01 standard to write, correct.



No one is right or wrong. The key is the doc type you declare.
Once you declare which side of your website you will use, it will be wrong if you know it is wrong.@ Lin can bin:
Zhihu, declared HTML5, but used
(HTML5 errors)
Lin is wrong (Mom and Dad deny others' denial)
Refer:
1. Historical Development of html standards: HTML tags, closed or not closed?
2. google-styleguide:
Http://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml? Showone = Document_Type # Document_Type
Yes. If the browser is not closed, it will determine where it is closed, increasing the running cost.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.