Simple HTML5 preliminary tutorial _ html5 tutorial tips-

Source: Internet
Author: User
This article mainly introduces the simple HTML5 preliminary tutorial. For some static text display methods, you can refer to HTML5 to represent the future. W3C (World Wide Web Consortium, World Wide Web Alliance) XHTML has been abandoned, making HTML5 a standard and recognized.

HTML5 is the next generation of HTML.
HTML5 will become a new standard for HTML, XHTML, and html dom, with the goal of replacing the existing HTML4.01 and XHTML1.0 standards. It is expected to reduce the dependency of Internet rich applications (RIA) on Flash, Silverlight, JavaFX, etc.
And more APIs that can effectively enhance network applications.
The previous version of HTML was born in 1999. Since then, the Web world has undergone great changes.
HTML5 is still in progress. However, most modern browsers already have some HTML5 support.
HTML5 is the result of W3C cooperation with WHATWG.
WHATWG focuses on web forms and applications, while W3C focuses on XHTML 2.0. On April 9, 2006, the two sides decided to cooperate to create a new version of HTML.
Rules for HTML5:
The new features should be based on HTML, CSS, DOM, and JavaScript.
Reduce the need for external plug-ins (such as Flash)
Better error handling
More replace script Markup
HTML5 should be independent of devices
Development process should be transparent to the public

Simplest HTML5 document

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document
  2. Let's rock the browser, HTML5 style.


A simple HTML5 document that contains only one line of text. Its effect in the browser is as follows:



More common structureAndTo separate the page information from the actual content, and useTo encapsulate the entire document. The current document is as follows:

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document
  2. Let's rock the browser, HTML5 style.

,AndHTML5 does not require these elements, but this writing style is better.

HTML5 Document Type

Copy XML/HTML Code to clipboard


The first line must be a specific document type declaration, which is used to indicate the standards followed by the document tag. HTML5 document type declaration is extremely simple.

Character encoding

Most websites now use UTF-8 encoding, Which is concise, fast to convert, and supports any non-English character you want.

It is easy to add the character encoding information in HTML5.Add Element, as follows:

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document


The Dreamweaver design tool automatically adds this metadata when creating a new webpage, and saves the file as UTF Encoding format. If you are using the simplest text editor, remember to select the correct encoding (UTF-8) when saving ).

Page Language

It is a good habit to specify the natural language used on a webpage. To specify a language for the content, you can use the lang attribute on any element.

Add a language description for the entire page, that isThe following code specifies the lang attribute for an element:

Copy XML/HTML Code to clipboard


If the page contains text in multiple languages, this information details are also useful for screen readers.

Add a style sheet

As long as it is a specially designed professional website, it will definitely use the style sheet. When specifying the CSS style sheet to be usedAdd Element, as follows:

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document


Add JavaScript

Adding JavaScript in HTML5 is similar to adding JavaScript on a traditional page, for example:

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document


You do not need to add the language = "JavaScript" attribute. The browser assumes that you want to use JavaScript.

Note:

If you want to spend a lot of time in IE testing pages containing JavaScript, you should also add a special comment called the Web sign (saved from url = ), this line of comment should be placed behind the specified character encoding element, as follows:

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document


This comment tells IE to view the page as downloaded from a remote website. Otherwise, IE switches to a special lock mode and a security warning is displayed, the JavaScript code is executed only after you click the "allow blocked content" button.

(0014) indicates the length of an internet string.

Final Result

A complete and beautiful HTML5 code is eventually as follows:

Copy XML/HTML Code to clipboard

  1. A Tiny HTML Document
  2. Let's rock the browser, HTML5 style.

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.