Comment: Most people use HTML 4 and XHTML 1 to write web pages. Relatively few HTML enthusiasts understand the concept of semantic HTML, verify HTML structure, and improve accessibility of documents. High-quality HTML documents are the result of repeated trade-offs, design selection, and discussion. Despite the criticism, no language has a popular performance comparable to HTML. Most users are satisfied with the current situation
Most people use HTML 4 and XHTML 1 to write web pages. Relatively few HTML enthusiasts understand the concept of semantic HTML, verify HTML structure, and improve accessibility of documents. High-quality HTML documents are the result of repeated trade-offs, design selection, and discussion. Despite the criticism, no language has a popular performance comparable to HTML. Most users are satisfied with the current status quo, as if they should be born like this.
But like many other standards, HTML has successors. Even now, experts are still considering the next version of HTML to solve all the problems known in the current version. Like anyone with many people, these experts also have different opinions on the future direction of this work.
The first proposal for the new HTML version came from a W3C organization's working group. The work group's idea revolves around XHTML 2—the standard continues the development direction of further purifying XHTML and returning to the first version of HTML design concept.
Some important HTML experts outside of W3C—browser vendors, web developers, authors and others—disagree with the direction of XHTML 2. In 2004, they formed an independent working group to propose a new design direction for the new HTML version. Under the name of WHATWG (Web Hypertext Application Technology Working Group), they launched HTML 5 and Web Forms 2.
Several years later, another direction of development of HTML was clearly described through the working draft. In April 2007, W3C voted on the proposal to accept HTML 5 into the standard audit process and (also) did not recognize it as a formal standard. Most people agree. So an interesting situation emerged: W3C studied two competing HTML and XHTML successor technologies at the same time. In theory, both have good reasons. In practice, many obstacles are overcome to make all mainstream browsers support these two standards.
This is the basic fact that leads to this situation at the moment. More meaningful is discussing the real differences between the two proposals. This article summarizes the basic points of the two proposals and then analyzes the design concepts of both. Commonly used abbreviation
CSS: Cascading Style Sheet
HTML: Hypertext Markup Language
W3C: World Wide Web Alliance
XHTML: A brief history of XHTML in Extensible Hypertext Markup Language
Understanding the design philosophy hidden behind XHTML 2 requires a little history. In the early 1990s, the first HTML version was based on the Standard General Markup Language (SGML). The main difference is the hyperlink characteristics—the key foundation and success factor of the World Wide Web. Like SGML, HTML allows the author to describe the structure of a document, separating the header from paragraphs, ordered lists, and unordered lists. The display results on the screen are related to the browser.
As the web becomes increasingly popular, HTML users require control of the appearance of the page. Browser manufacturers have introduced new features in HTML 2 and 3. Web pages become difficult to understand, and complex nested table structures become the main means to control page layout. The rest of the document is filled with font tags and color declarations. The original document structure is difficult to sort out.
HTML 4 is introduced to end this confusion, pushing representation logic to CSS, introducing a layer (DIV) for advanced content positioning. Compared with HTML 3, this means changes in the code writing pattern. To simplify the migration process, the old HTML 3 structure is supported through the Transitional version of HTML 4. The Strict version for advanced users requires that the content and representation be completely separated.
The first HTML 4 website uses DIV as a new holy grail, and almost every element in the page that needs slightly modified, including (but not limited to) the header. HTML style attributes are common places where details are described. The flood of forms were finally eliminated from the web pages. But the content and presentation logic are still mixed. The essential CSS file is only a few lines.
Recently, some well-known web developers have come up with a more clever approach to HTML 4 stylesheets. In modern browsers, CSS attributes are not limited to DIV elements. You can specify styles for any HTML element as long as you like. A lot of weblogs start talking about semantic HTML. DIV elements are not completely banned, but web writers are starting to use HTML elements that are best suited to describe their content. For example, the navigation menu of most websites is best described in an unordered list. For example, instead of using a class name like bigHeader for paragraph elements, change it to H1 element, and then use CSS to modify the representation according to the requirements.
At the same time, W3C proposed XHTML 1 as an XML version that conforms to the well-structured and effective HTML 4. For XML users, this simplifies the work of converting XML content into web pages and checking conversion results with existing verification programs. XHTML 1.1 tries to isolate different problems into different modules. The modular approach facilitates the reuse of different parts of the standard for different needs, and also facilitates the expansion of the standard with new features.
Compared with HTML 4, XHTML 1.1 has even more users, separating content and representation. But as in the past, some practical problems can only be solved using techniques in CSS. For example, menu structures represented by unordered lists usually include beautiful pictures. However, images are not easy to read through text-voice facilities to people with visual disabilities. Moreover, text browsers like Lynx cannot display images. A complex CSS trick to hide text in the browser to display images. However, if the menus on different pages are different, it is difficult to specify this part of the content with CSS. The design concept behind XHTML 2
The most important design philosophy behind XHTML 2 is to further separate content and presentation, improving the residual flaws in HTML 4 and XHTML 1. For example, specify native support for images for each item in the unordered list. The original IMG SRC tag was replaced with an optional attribute SRC that can be used for any element. The modified CSS is completely out of content, and devices that do not support images can easily turn to represent text.
But CSS is not the only challenge for web developers. A lot of time is spent on the interaction between servers and HTML forms and the presence of a lot of JavaScript™ code. Forms are limited to one-dimensional key-value pairs. Developing JavaScript code is a lot of work, but it is useless on interfaces like text-voice conversion devices.
Based on a modular approach, XHTML 2 replaces HTML Forms with the XForms module, adding support for FAQs using the appropriate application model. XForms does not require a single line of scripts to specify interaction logic, verification rules, and calculation methods. Additionally, this technique uses rich XML structures rather than key-value pairs, allowing nested subforms and duplicate elements to appear. In addition to providing a powerful engine, text-voice devices are more suitable for changing the richness of applications.
In addition to XForms, there are other XHTML-related issues extracted into independent specifications to meet other needs—such as XML Events, XFrames, and Ruby (Asian language).
With the separation of representations, programming is also separated from the standard. Interactive properties such as onClick are replaced by the XML Events module. Since the XML Events specification itself is designed for this, it provides a more powerful set of tools to handle user interfaces.
For the innovation of XHTML 2, the basic concept is to break down different problems. The problem is no longer a secondary feature of HTML, but the main purpose of the new specification. Therefore, the new specification is best suited to the problems faced by optimization. However, the difference in different issues is due to the need for ideas rather than practice. Smart developers familiar with using this set of tools can get the results they need. However, it is not easy to say whether the average user of the current HTML version can create high-quality XHTML documents.
The target of XHTML 2 is likely not the average HTML user. But in the hands of good developers, it can be a good way to enhance accessibility. HTML 5 design concept
WHATWG adopted a more realistic approach when designing HTML 5. Without considering abstract concepts such as problem breakdown, this working group formulates documents based on the behavior of current mainstream browsers, which is completely different from the W3C specification. Based on the above analysis, this working group investigated the actual use of HTML.
Based on this information, the Working Group proposed a program designed to simplify the work of general Web developers. Although HTML 5 claims to be derived from the previous HTML version, its main goal is not purity. For example, the main goal of modular documents is to facilitate replacement with optimized web applications.
The modular language based on this purpose greatly simplifies the development of web applications. For example, HTML 5 supports interactive components such as data tables, menus, and toolbars. Using descriptive HTML elements with default behavior can avoid simulating the behavior of a general DIV with a lot of code.
The HTML 5 specification is not limited to HTML elements and attributes. It defines dedicated JavaScript APIs such as editing documents and drag-and-drop interactions. This method is completely different from the method of decomposing problems. It simplifies the Web Developer API but increases the size of the specification.
The similarity between HTML 5 and HTML 4 is much greater than that between XHTML 2 and XHTML 1. The migration path is flatter, and it is also more convenient for experienced HTML 4 developers to be familiar with the new version. New features follow similar logic. Special event properties for specific elements allow HTML editors to provide more appropriate text completion capabilities.
Current interactions between web applications and servers depend on asynchronous JavaScript XML (Ajax). HTML 5 recognizes the importance of interacting with servers, defines a variety of ways to interact with the network, distribute received server events, and send messages from other domains to documents without causing security issues.
The basic design philosophy of HTML 5 is to extend HTML 4 using features that web developers need. HTML 5 is simplified while inheriting the basic HTML 4 technology. In order to solve the shortcomings of HTML V4, HTML V5 chose the easiest and most direct way to redesign. Practical application of new standards
XHTML V2 and related modules are officially supported by W3C, and related modules have become an important factor in other XML specifications supported by W3C. Unfortunately, official W3C recognition does not guarantee support for mainstream web browsers. Supporting general XHTML V2 is not a problem: modern browsers already support a lot of features. Proper use of XHTML V2 depends on the availability of the relevant modules. At the time of writing, it is unclear whether Microsoft wants to extend Windows® Internet Explorer® to support XML Events and XForms. A Mozilla XForms plugin, including XML Events, has been in development for several years. This plugin improves the functionality of this technology and reduces the difficulty of implementation.
The writing of HTML V5 specifications maintains in-depth communication with browser manufacturers and always takes into account implementation issues. Although the team expressed doubts about the official W3C endorsement. The FAQ didn’t even formally answer the question of when formal approval was passed. Regardless of W3C's attitude, browser vendors seem to have decided to implement the informal HTML 5 standard. This is not the first time that browser manufacturers have been able to make official standards available. Competing standards
So far, neither HTML 5 nor XHTML 2 are formally recommended standards. Some subtle areas may change in the future. But their development direction will not change, both of which solve some of the shortcomings of the current standards. It remains to be seen how future browsers can increase support for these two new standards. The current browser supports both HTML 4 and XHTML 1. Similarly, future browsers may support both HTML 5 and XHTML 2. Both standards have their own supporters.
If you care more about XHTML 1.1 than HTML 4, you hope that the document you create can support different devices, and you may prefer XHTML 2. If you use XHTML 1 just because it complies with XML standards and prefers the new features of HTML 5, XHTML 5 (HTML 5 rewritten in XML) may be your best choice.
HTML 5 is popular among developers who use HTML 4 to develop interactive web applications. This approach is more feasible for sites using the WYSIWYG document editor. However, in order to analyze the specific situation, HTML 4 and XHTML 1 may coexist for a long time.