Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of getting started with HTML5

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

In this issue, the editor will bring you an example analysis of the preliminary introduction to HTML5. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

HTML5 represents the future; the W3C (World Wide Web Consortium, World wide Web Consortium) has abandoned XHTML, making HTML5 a formal standard and recognized.

HTML5 is the next generation of HTML.

HTML5 will become the new standard for HTML, XHTML and HTML DOM, with the goal of replacing the existing HTML4.01 and XHTML1.0 standards. It hopes to reduce the dependence of Internet rich applications (RIA) on Flash, Silverlight, JavaFX, etc.

Lai, and provide more API that can effectively enhance network applications.

The last version of HTML was born in 1999. Since then, the Web world has undergone great changes.

HTML5 is still in the process of improvement. However, most modern browsers already have some HTML5 support.

HTML5 is the result of cooperation between W3C and WHATWG.

WHATWG focuses on web forms and applications, while the W3C focuses on XHTML 2.0. In 2006, the two sides decided to work together to create a new version of HTML.

Some rules established for HTML5:

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 tags that replace scripts

HTML5 should be device independent

The development process should be transparent to the public

The simplest HTML5 document

A Tiny HTML Document

Let's rock the browser, HTML5 style.

An ultra-simple HTML5 document with only one line of text that looks like this in a browser:

The more common structure is used to block and, separating the information of the page from the actual content of the page, and to encapsulate the entire document, which now looks like this:

A Tiny HTML Document

Let's rock the browser, HTML5 style.

, and HTML5 do not require these elements, but this writing style is better.

HTML5 document type

The first line must be a specific document type declaration that tells subsequent document tags which standard to follow. HTML5's document type declaration is extremely simple.

Character coding

Most websites now use the UTF-8 code, which is concise, fast, and supports any non-English character you want.

It is easy to add character encoding information in HTML5. Add elements in the following:

A Tiny HTML Document

The Dreamweaver designer automatically adds this meta-information when you create a new web page and also saves the file in UTF encoding format. If you are using the simplest text editor, remember to choose the correct encoding (UTF-8) when saving.

Page language

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

To add a language description to the entire page is to specify the lang attribute for the element, as shown in the following code:

This information detail is also useful for screen readers if the page contains text in multiple languages.

Add a style sheet

As long as it is a specially designed professional website, it is sure to use stylesheets. "when you specify the CSS stylesheet to use, you need to add elements to the, as follows:"

A Tiny HTML Document

Add JavaScript

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

A Tiny HTML Document

There is no need to add the language= "JavaScript" attribute. The browser assumes the JavaScript you want to use.

Pay special attention to:

If you want to spend a lot of time testing pages that contain JavaScript in IE, you should also add a special comment called the Web flag (saved from url=), which should be placed after the specified character encoding element, as follows:

A Tiny HTML Document

This comment tells IE to treat the page as downloaded from a remote site, otherwise IE will switch to a special locking mode, pop up a security warning and execute the JavaScript code after you click the "allow blocked content" button.

(0014) refers to the length of the about:internet string.

The final result

A complete and beautiful HTML5 code ends up as follows:

A Tiny HTML Document

Let's rock the browser, HTML5 style.

The above is the example of the preliminary introduction to HTML5 shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report