Home  >  Article  >  Web Front-end  >  Things you have to know about HTML5

Things you have to know about HTML5

一个新手
一个新手Original
2017-09-06 17:44:041605browse

Abstract: HTML5 may not be a fully finalized standard, but it won’t change much—and acceptance is growing. Justin James highlights key concepts of this new specification.

A year or two ago, HTML5 seemed to be a vague concept that only a few Internet nerds would care about. But now, it feels as if HTML5 is everywhere. Thanks to the rapid release of Mozilla and Chrome, and the deployment of Microsoft's IE9 (IE10 is also now in "Technical Preview" status), a limited (or better than limited) number of browsers that support HTML 5 are almost universally available. enjoy. Developers began to take advantage of widely implemented features. HTML 5 will be fully supported in less than a year, and the specification is quickly reaching a stable state. Now is a good time to learn some things you need to know about HTML 5.

 1: XHTML is no longer, HTML 5 (that supports XML syntax) will always exist

 XHTML is the choice for people who like precision, especially in terms of parsing. The appearance of HTML has always been similar to XML in many places, but it will never be exactly the same as XML. Therefore, trying to parse it as XML will fail. Therefore, not long ago, XHTML was developed to replace the HTML language and classified it under the term XML. When work on HTML 5 first started, there was also work on XHTML 2, but it was eventually shelved. On the contrary, the HTML 5 specification was developed to allow you to write working HTML 5 documents that follow strict XML syntax. If you send it with the XML MIME type, the client will also parse it as an XML document. This gives developers the best of both worlds.

 2: The myth of 2022, the reality of 2011

Regarding HTML 5, one of the widely circulated misunderstandings is that "it will not be completed before 2022." Typical supporting evidence is an interview I conducted several years ago with Ian Hickson, editor of the HTML 5 specification. Ironically, even in that interview, he was clear about the 2022 date. But some people are excited about it, and their angry articles attract far more attention than the actual facts.

The fact is that 2022 is the day when Hickson expects the HTML5 specification to become a full W3C recommendation. By that time, there will be two 100% complete, verifiable implementations. This is both fairly pointless and at the same time a huge leap forward. To give you an idea of ​​why, consider that no other version of the HTML specification has ever reached that status. This is mainly because for any implementation Saying it needs to be verifiable correct is too vague. The HTML 5 specification is close to being solidified now, in 2011.

 3: For most developers, this is the Flash and Silverlight killer

Although HTML 5 does make several improvements in how it is used to mark up documents, the big ones The focus remains on applications. The number of features introduced by HTML 5 to support application development is staggering. That's not to say Flash and Silverlight are going away anytime soon. But Microsoft has announced that it is refocusing Silverlight on experiences outside of the browser. Flash and Silverlight still have some capabilities that HTML 5 doesn't have, but for many common goals, the divide is now closed thanks to HTML 5's new capabilities. It may not be worth rewriting an existing application, but you should see if HTML 5 makes sense for a new application.

  4: It is the cornerstone of many new tools

As HTML 5 becomes a fully mature application framework , tool makers, especially those designed to overcome cross-platform development issues, are now using it as a foundational technology for their products. If you're looking to write apps that run cross-platform and are within the capabilities of HTML 5, you should consider these tools. This is especially important in the mobile space, because otherwise you would need to learn a whole new language, API, and framework for each mobile platform you plan to target.

 5: Important and controversial tag

My personal choice for “Best New Features of HTML 5” is tag. Before (and with tags), you had to resort to Flash or Silverlight yourself to provide a media player for your website. With these new labels, in theory, those days are gone. Why just "theoretically"? Sadly, due to patents, different browser manufacturers are not quite sure which formats they should support. And once the dust settles, both Flash and Silverlight will lose their #1 use case.

 6: Google Google, take the lead

If it seems that the Chrome browser has an excellent start on HTML 5, then there is a good reason here. The development of the HTML 5 specification put a lot of emphasis on writing and deploying code. By that I don't mean that they rubber stamp whatever any browser vendor does. But it's harder to convince those involved in writing the specification to accept features that haven't been implemented yet; implemented features are more likely to be included as the basis for new projects in the specification. Since Chrome seems to release a new version every few weeks, there is a good chance that the new features added by Google will also be included in the HTML5 specification.

 7: "Standards Compliant" Finally Proven

Whenever someone claims that a browser is or is not "standards compliant", I have to laugh. Before HTML 5, standards compliance was simply impossible to prove. In many cases, the current specification is too vague or simply silent on important issues (like handling parsing errors), with the result that different browsers can do a wide range of different things and still be either standards-compliant, Either it is classified as "Incompatibility Unverifiable". Even the most famous ACID test doesn't prove much because it only tests a subset of HTML. The threshold of HTML 5 has been raised a lot, and it is finally possible to prove that a user agent is standards-compliant. Indeed, one of the reasons behind the 2022 date for reaching "recommended" status is the need to write fully test packages.

 8: "Standards Compatibility" Still Doesn't Guarantee Appearance

Standards compatibility in web browsers does not behave as people usually think, and HTML 5 does not change this fact. One of the big confusions about HTML is that many web designers and developers believe that the HTML specification controls the appearance of screen items; this is not the case. For example, if it likes it, a web browser can make tags use a larger or different color font instead of bold and still maintain compatibility. Many times, when designers say that a browser is not compliant with a standard, what they are really encountering is giving user agents flexibility in how to display tags. HTML5 doesn't change that fact. If you must have a label appear in a precise way, don't rely on the browser's default behavior and specify your needs in CSS.

 9: More accurate parsing

The HTML5 specification finally introduces precise parsing rules and defines what user agents should do when encountering parsing errors. Therefore, you can expect that some things that used to be passed as acceptable or even "legal" HTML in the past no longer do so. You'll want to familiarize yourself with HTML5's parsing rules and make sure your code complies with their requirements.

 10: HTML5 is Far from a Browser

In previous versions of HTML, there was an inherent assumption that the traditional web browser was the user agent of choice. Although other user agents and content types are supported, the implicit idea is that they are not equally important. However, HTML5 has made many changes to treat non-browser, non-desktop-sized user agents more equally with browsers. There's a lot of progress being made on things like how well it works with screen readers and mobile phones. So, well-written HTML5 is a "write once, see anywhere" framework for developers who need it, and for users who otherwise struggle with the web (especially those with various barriers people) works.

The above is the detailed content of Things you have to know about HTML5. 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