What's the difference between html4,html5,xhtml?

Source: Internet
Author: User

I'll talk about the difference between the 3 of them from the history of HTML.

In the early development of HTML, many of the standards were developed before the developers of the browser discussed each other, such as HTML 2.0, 3.2 until 4.0, 4.01, most of which are called Retro-spec, That is, there are standards before implementation. In this case, the HTML standard is not very normative, the browser is also very tolerant of errors in the HTML page. This in turn has led to the HTML author writing a large number of HTML pages that contain errors. Today, 99% of pages on the Web are said to contain HTML errors.

The web was then aware of the problem and considered it a fundamental issue for the Internet and should be addressed. In order to standardize the XHTML 1.0 standard for HTML,W3C binding XML, this standard does not add any new tags, but only follows the XML requirements to standardize the HTML and defines a new MIME type,application/xhtml+xml. The purpose of the web is to enforce a strong error check on this MIME type browser, and display an error message if the page has an HTML error. However, due to the large number of errors already in the existing Web pages, many developers refuse to use the new MIME type. After the XHTML 1.0 standard, an Appendix C was added to allow developers to write pages using XHTML syntax while using the old MIME type,application/html to distribute the pages. This old MIME type does not trigger a strong error check on the browser. That's what we're seeing today, and many websites claim to abide by the XHTML 1.0 standard, which simply says that the XHTML syntax is used in his page, but it's not guaranteed to be completely error-free. To verify that XHTML does not really work, you need to see what MIME type the Web server uses to distribute the page.


Web site subsequently canceled Appendix C in XHTML 1.1, where pages using the XHTML 1.1 standard must be distributed with a new MIME type. So this standard is not used by many people. This also happens in the unfinished XHTML 2.0, which requires a strong error check, so no one uses it. The XHTML story also tells us that sometimes it doesn't work to have standards before they come true.

When XHTML 1.0 and XHTML 1.1 achieved a relatively large success, the world wide confidence, the entire industry believes that the Alliance defeated Ie,ie by more and more browser challenges, such as Chrome, Firefox, Webkit, finally, Content providers are beginning to be inclined to provide non-IE compatible content, IE's absolute market monopoly has been broken. People think that this is the victory of the people, the standard victory, the victory of the public.
At the same time, the success of XML has also dazzled the brains of the HTML Working Group, and more and more protocols choose XML as the underlying interface. Let's all use XML, the world's most enjoyable decision. But it is clear that the Tucson of the pattern is broken. Standards, always in the hands of the browser manufacturers. In fact, IE's market share is only eaten by the WebKit core. Market standards are just from one oligarch to another. The WHATWG XHTML 2.0 was bold and the original HTML is no longer compatible, browser vendors finally angry, Mozilla and Apple led, the group was founded. The XHTML2 standard, which lost the vendor's support, soon became a joke.

With the lessons of XHTML, what working Group and the great-for-all have made backwards compatibility a very important principle when developing next-generation HTML standards, or HTML5. HTML5 does introduce many new features, but one of its most important features is that it does not break the existing Web page. You can change the first line of any existing page to <! DOCTYPE Html>, it becomes also a HTML5 page, and can still be displayed normally in the browser.

The reason for XHTML losing is simple, because web development is more about functionality and robustness than academic and rigorous.
XHTML was developed by the academic web, and did not bring new functionality to HTML, just using XML to standardize HTML, trying to use XML to erase some of the flaws in the HTML design (the most important is the different interpretations of the browser- The reason why the browser explains the difference is that HTML4 does not stipulate a unified fault-tolerant system for illegal HTML pages, which causes different browsers to adopt their own fault-tolerant mechanism, which indirectly results in different rendering of the same page in different browsers, which is for web designers In addition to some of the less-canonical HTML pages that you wrote before, you don't have any positive meaning (there's a positive meaning for the industry as a whole – to make HTML more prescriptive and rigorous – but it's clear that the meaning is too vague to be accepted by most designers).
HTML5 was developed directly by web companies (Google, Adobe) and browser vendors (Moz, Opera, and Apple), which stand on the forefront of HTML applications, and adopted a more receptive approach than regulatory limitations: A unified definition of HTML fault-tolerant methods, So no matter what browser, as long as the standard implementation of fault-tolerant methods, even if the Web page defects, the rendering results are exactly the same. In other words, when a web designer migrates to HTML5, it can basically do nothing. Previously, even non-standard web pages with a certain flaw could be rendered normally and in the same way. On top of this, HTML5 added a lot of application features, including new tags, CSS3, more system JS API, and so on, greatly enhanced the functionality of the Web app, can be widely accepted and promoted is also reasonable things.
When it comes to explaining the prediction mistakes, it is easy to understand that those who agree with XHTML are HTML4 by the standard flaws of the industry, and feel that the trade will move in a more standard and complete direction, and that HTML5 not only solves the problem of standard flaws, but also brings more and better features, of course, wins.

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.