This article mainly introduces the basic features and syntax of HTML5, which is the basic knowledge in the introduction to HTML5. Friends who need it can refer to HTML5 Overview
HTML5 is the next important version of the HTML standard to replace HTML 4.01, XHTML 1.0 and XHTML 1.1. HTML5 is also a standard for building and presenting content on the World Wide Web.
HTML5 is the product of the collaboration between the World Wide Web Alliance (W3C) and the Working Group on Hypertext Technology of Web Pages (WHATWG).
This new standard incorporates features such as video playback and drag-and-drop, which used to rely on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.
Browser supportThe latest versions of Apple Safari, Mozilla FireFox and Opera support most HTML5 features, and IE9 also supports some HTML5 features.
Mobile browsers preinstalled on iPhones, iPads and Android phones all have good support for HTML5.
New FeaturesHTML5 introduces many new elements and attributes to help us build modern websites. Here are the main features introduced by HTML5:
New semantic elements: such as <header>, <footer> and <section>.
Form 2.0: Improved HTML Web forms and introduced some new properties to the <input> tag.
Persistent local storage: In order not to be implemented through third-party plugins.
WebSocket: The next generation of two-way communication technology for web applications.
Server push events: HTML5 introduces events from a web server to a web browser, also known as server push events (SSE).
Canvas: Supports programmatic two-dimensional drawing using JavaScript.
Audio and Video: Embed audio or video in web pages without the need for third-party plug-ins.
Geolocation: Users can choose to share their geolocation with our webpage.
Microdata: Allows us to create custom vocabulary outside HTML5 and extend web pages using custom semantics.
Drag and drop: Drag and drop an entry on the same webpage from one location to another.
Backward compatibleHTML5 is designed to be as backward compatible as possible for existing browsers. New features are built on existing features and allow us to provide alternate content for old browsers.
It is recommended to use a small amount of JavaScript code to detect the support of a single HTML5 feature.
HTML5 syntaxHTML5 has its own HTML syntax, which is compatible with HTML 4 and XHTML1 documents that have been published on the web, but does not have the more complex SGML features in HTML 4.
HTML5 does not require lowercase tag names in XHTML, attributes must be quoted, attributes must have a value, and syntax rules that must close all empty elements.
However, HTML5 is more flexible and supports the following forms:
Tag name capitalization.
Double quotes for the attribute are optional.
The attribute value is optional.
Closed empty element is optional.
DOCTYPE
In older versions of HTML, DOCTYPE is long because the HTML language is based on SGML and requires a DTD to be referenced.
HTML5 authors can use simple syntax to specify the following form of DOCTYPE:
XML/HTML Code Copy content to clipboard