Home > Web Front-end > H5 Tutorial > The innovation of HTML5 and the beauty of structure_html5 tutorial skills

The innovation of HTML5 and the beauty of structure_html5 tutorial skills

WBOY
Release: 2016-05-16 15:51:04
Original
1222 people have browsed it
Foreword
HTML 5 is like a revolution, which is going on vigorously in the post-Web2.0 era.
What HTML 5 is, I don’t need to go into details here. As for the innovation of HTML 5, according to my understanding, it can be summarized as a tag system with clear semantics, rich media support that simplifies complexity, magical local data storage technology, rich animation (canvas) that does not require plug-ins, and powerful API support. . In short, HTML 5 makes human-computer interaction more comfortable and user-friendly. The previous lack of support for rich media applications and native storage is no longer a pain point for browsers. Pushing the Web from a content platform to a standardized application platform and unifying the standards of various platform camps is the original intention of the HTML 5 revolution. In this article, I will introduce some ideas and explain one of the innovations of HTML 5: a clearer and more concise structure with semantics.

Start with the "head" A standard XHTML header code should be like this:


Copy codeThe code is as follows:






Can you remember? Will you memorize it by rote? Of course not! We just need to mechanically copy and paste.
Look at what a standard HTML 5 header looks like:


Copy the codeThe code is as follows:



It’s more complicated than simple, I don’t need to say it. Yes, the HTML 5 header can be so simple and easy to remember! Also, case, quotes, and the backslash before the last angle bracket can be ignored.
Why can it be so loose? In fact, if you send XHTML as text/html, the browser can parse it well, and the browser does not care about the syntax of the code. Therefore, HTML 5 is metaphysical. It may break some original standards, but it can still perform well in browsers.
Of course, for the convenience of team assistance and subsequent maintenance, we should still unify a writing style that you like, such as:


Copy code The code is as follows:




...


...



In addition, although HTML 5 is not currently supported by all browsers, this can save more than 100 bytes (for sites with more than one million daily PV, it can save a lot of traffic) ) head is now perfectly compatible. If you have researched browser parsing modes, you should know that the page will trigger weird mode if doctype is not defined, but as long as is defined, the browser can parse the page in standard mode, and There is no need to specify a certain type of DTD.

New semantic tag system Semantic coding is an essential skill for a qualified front-end developer. However, as web pages become increasingly rich, only the original xhtml tags are used to de-semantize them. It was obviously beyond his capabilities. God said: "Let there be light!" And there was light. Therefore, HTML 5 provides a series of new tags and corresponding attributes to reflect the typical semantics of modern websites. Practice the truth. Let’s write an example:


Copy the codeThe code is as follows:


< ;!--//header end-->


This is an article Article about HTML 5's new structural tags.




This is an article about the new structure tags of HTML 5.






About the author


Mr.Think, an ordinary person who focuses on Web front-end technology.







The above is a simple blog page partial HTML, consisting of the header, article display area, right Composed of sidebar and bottom. The coding is neat and conforms to the semantics of XHTML. It can perform well even in HTML 5. But to the browser, this is a piece of code without distinguishing weights, rather than a tag that allows machines to understand the semantics to define the corresponding block. For example, standard browsers (such as Firefox, Chrome and even the new version of IE) have a shortcut key that can lead customers to jump directly to the page navigation, but the problem is that all blocks are defined with DIV, and the ID value of the DIV It is determined by the developer, so the browser does not know which block should be the navigation link. The emergence of HTML 5 new tags just makes up for this shortcoming. Then, the above code can be written like this in HTML 5:

Copy the code
The code is as follows:



Website title


Website subtitle


< /hgroup>




This is an article about the new structural tags of HTML 5.




This is an article about the new structure tags of HTML 5.






Bottom of the web page


It turns out that the page structure of HTML can be like this The beauty can be seen at a glance without comment. For the browser, finding the corresponding block will no longer be at a loss.
How to use HTML 5 new tags to structure elements
Through the above example, we understand the structural innovation of HTML 5 new tags, but when it comes to actual use, how to use them appropriately? I think this is also a question that many HTML 5 learners want to ask. Just like XHTML semantics, the use of HTML 5 semantic tags should also follow: each tag has its specific meaning, and semantics allows us to use appropriate tags at the appropriate location to better understand people and The machine (the machine can be understood as a browser or a search engine) can understand it at a glance. For example, the header tag is generally the first block element of the page (the header tag can also be used in type header elements, such as the title of an article block), which contains the topic information of the page; the nav tag is generally used to wrap navigation information. ;footer is generally used to wrap information at the bottom of the page; etc.
The following is the semantic explanation and usage guidelines of the commonly used new tags of structural classes that I listed with reference to the HTML 5 manual:
tag
Manual explanation: Define the header of a section or document.
Usage guidelines: Generally used to include page headers, but can also be used for other area headers, such as article headers:

Copy code
The code is as follows:



Website title


Website subtitle




Tag
Manual explanation: used to modify the title of a web page or section combination.
Usage guidelines: Used for the combination of title types, such as the title and subtitle of an article:

Copy code
code As follows:


This is an article introducing HTML 5 structural tags


Innovation of HTML 5< ;/h2>



Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template