HTML5 Tutorial


HTML5 is the latest revised version of HTML. The standard was completed by the World Wide Web Consortium (W3C) in October 2014.

HTML5 is designed to support multimedia on mobile devices.

HTML5 is simple and easy to learn.


What is HTML5?

HTML5 is the next generation HTML standard.

HTML, the previous version of HTML 4.01 was born in 1999. The world of the Web has changed dramatically since then.

HTML5 is still a work in progress. However, most modern browsers already have some HTML5 support.


How did HTML5 get started?

HTML5 is the result of collaboration between W3C and WHATWG, which stands for Web Hypertext Application Technology Working Group. .

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

Some interesting new features in HTML5:

  • canvas element for drawing

  • for media playback video and audio elements

  • Better support for local offline storage

  • New special content elements, such as article, footer, header, nav, section

  • New form controls, such as calendar, date, time, email, url, search


##HTML5 < !DOCTYPE>

<!doctype> The declaration must be located on the first line in the HTML5 document. It is very simple to use:

<!DOCTYPE html>


Minimum HTML5 document

Below It is a simple HTML5 document:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
</head>

<body>
文档内容......
</body>

</html>

Note: For Chinese web pages, you need to use <meta charset="utf-8"> to declare the encoding , otherwise garbled characters will appear.


Improvements in HTML5

  • New elements

  • New attributes

  • Fully supports CSS3

  • ##Video and Audio
  • ##2D/3D graphics
  • Local Storage
  • Local SQL Data
  • Web Application
  • HTML5 Multimedia

Using HTML5, you can simply play video and audio on web pages.

HTML5 <video>
  • HTML5 <audio>
  • ##HTML5 Application
Using HTML5 you can simply develop applications

Local data storage

  • Access local files

  • Local SQL Data

  • Cache Reference

  • Javascript Worker

  • XHTMLHttpRequest 2

  • ##HTML5 Graphics

  • Using HTML5 you can simply draw graphics:

Use < canvas> element

  • Use inline SVG

  • Use CSS3 2D/3D

  • HTML5 Using CSS3


New Selector

  • New Properties

  • Animation

  • 2D/3D conversion

  • Rounded corners

  • Shadow effect

  • Downloadable fonts

  • To learn more about CSS3, please check out the CSS3 tutorial on this site.

  • Semantic Elements

HTML5 adds a lot of semantic elements as follows:

##<article>Define an independent content area of ​​the page. <aside>Define the sidebar content of the page. <bdi>Allows you to set a piece of text independent of the text direction setting of its parent element. <command>Define a command button, such as a radio button, check box, or button< details>Used to describe the details of a document or a certain part of a document##<dialog><summary>##<figure> is specified independently of streaming content (images, charts, photos, code, etc.). <figcaption>Define the title of the <figure> element<footer>Define the footer of section or document. <header> Defines the header area of ​​the documentDefine text with tokens. Define weights and measures. Use only for measurements with known maximum and minimum values. The part that defines the navigation link. Define the progress of any type of task. Define ruby ​​comments (Chinese phonetic notations or characters). Define the interpretation or pronunciation of a character (Chinese phonetic phonetic or character). is used in ruby ​​comments to define the content displayed by browsers that do not support ruby ​​elements. Define the section (section, section) in the document. Define the date or time. Specifies where in the text it is appropriate to add line breaks.
TagDescription
Define a dialog box, such as a prompt box
The tag contains the title of the details element
##<mark>
<meter>
<nav>
<progress>
<ruby>
<rt>
<rp>
<section>
<time>
<wbr>

HTML5 Form

New form elements, new attributes, new input types, automatic validation.


Removed Elements

The following HTML 4.01 elements have been removed in HTML5:

  • ##<acronym>

  • <applet>

  • ##<basefont>
  • ##<big>
  • <center>
  • <dir>
  • ##<font>

  • <frame>

  • <frameset>

  • ##<noframes>

  • <strike>

  • ##Examples in each chapter

    With our HTML editor, you can edit HTML and then click the button to View Results.

Instance

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
<meta charset="utf-8">
</head>
<body>

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  你的浏览器不支持 video 标签。
</video>

</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance

Click the "Try it" button to view the online running results.

HTML5 Browser Support

The latest versions of Safari, Chrome, Firefox, and Opera support certain HTML5 features. Internet Explorer 9 will support certain HTML5 features.


The method for IE9 and the following versions of browsers to be compatible with HTML5 is to use the html5shiv package of Baidu static resources:

<!--[if lt IE9]> 
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<![endif]-->

After loading, initialize the CSS of the new tag:

/*html5*/
article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}

HTML5 Reference Manual

In this site you can find tags and attribute descriptions about HTML5. For details, please click HTML5 Reference Manual.