First, the story of HTML5
The basic idea of HTML--the use of elements to add structure to content--has not changed since the advent of the web.
1 XHML 1.0: Stricter standards
HTML5 contains several criteria that are related to each other.
- HTML5 Core. This section is made up of the official specifications of the website, involving new semantic elements, new enhanced Web Forms widgets, audio and video support, and canvas drawing through JavaScript.
- Once belonged to the HTML5 function. This part stems from the HTML5 specification originally developed by WHATWG, most of which require JavaScript and support rich Web application development. The most important include on-premises data storage, offline applications, and message delivery.
- Sometimes it is called the HTML5 function. These usually refer to the next-generation feature. Although they have never entered the HTML5 standard, people often equate them with HTML5. This section includes CSS3 and geo-positioning.
Ii. three main principles of HTML5
1 Do not destroy the Web
"Do not break the web" means that standards should not introduce changes that cause existing Web pages to fail to work.
"Do not break the web" also means that the standard should not unexpectedly change the rules, can not be determined today is still the perfect page to tomorrow will be void.
2 Mending Cattle Hoof Road
HTML5 standardized these unofficial technologies.
3 Practical First
The change should be used for the purpose.
Third, HTML5 Mark first Experience
1 HTML5 Document Type
The first line of each HTML5 document must be a specific document type declaration. This document type declaration is used to declare which standard the following document tag follows. The following document declaration flags follow the HTML5 standard:
<! DOCTYPE html>
Document type declarations are preserved primarily for historical reasons. If there is no document type declaration, most browsers will be converted to a promiscuous pattern (quirk mode). In this mode, the browser tries to render the Web page according to a somewhat less normal rule (those rules are used in the old version of the browser). The problem is that the promiscuous mode of different browsers is not the same, because a browser-designed page to another browser, not the font size is not the same as the layout of the flaw, or other inconsistent issues.
When you add a document type declaration, the browser knows that you want to use a stricter standard mode, in which all modern browsers display Web pages in a consistent format and layout.
2 character encoding
Character encoding is a standard that a computer converts text to a sequence of bytes stored in a document.
It is also easy to add character encoding information to the HTML5 document. Just add the <meta> element at the beginning of the
< Head > < charset= "Utf-8"> <title>A Tiny HTML Document</title></head>
3 Page language
It is a good practice to specify the natural language used in Web pages. This information is sometimes useful to others, such as search engines that can filter search results, making sure to search only for pages that return the same language as the language in which they were used.
To specify a language for the content, you can use the lang attribute on any element and specify the appropriate language code for that property (for example, en for English).
Iv. starting today with HTML5
1 dealing with older versions of browsers
1) Smooth degradation. Sometimes, if a feature is not supported by the browser, it is not a big problem. For example, the,<video> element provides a fallback mechanism to provide alternative content to older browsers. There are also form features, such as placeholder text, and CSS3 properties such as fillets and projections that older browsers can completely ignore. Of course, you can write some JavaScript code to detect whether the browser supports the features you want to use. If not supported, displays less content or uses a less fancy way.
2) with JavaScript. Some of the features in HTML5 can be fully implemented using a good JavaScript library. Some of them are more mature to become "putty script".
2 Understanding Browser Support
The Can I use website provides a detailed list of HTML5 support for each mainstream browser.
3 Browser Installed status statistics
Browser usage statistics can tell you how many users ' browsers support the features you want. To do this, you can view the popular traffic tracking site Globalstats. URL http://gs.statcounter.com.
4 through Modernizr detection function
Detection capabilities are an important strategy to address browser support differences. The typical pattern is to load the page and detect whether a specific feature is available through a JavaScript script.
MODERNIZR (www.modernizr.com), a small, continuously updated tool designed to test the browser's support for many HTML5 and related functions.
5 Filling functional defects with "putty script"
The Putty script is a whole bunch of technology, the purpose is to fill the old browser to HTML5 support defects.
[Note] "HTML5 cheats"-HTML5 introduction