search
HomeWeb Front-endH5 TutorialSimple HTML5 preliminary introductory tutorial_html5 tutorial skills

HTML5 represents the future; W3C (World Wide Web Consortium, World Wide Web Consortium) has abandoned XHTML, making HTML5 an official 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 Rich Internet Applications (RIA) on Flash, Silverlight, JavaFX, etc., and provide more APIs that can effectively enhance network applications.
The last version of HTML was created 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.
HTML5 is the result of a collaboration between the W3C and the WHATWG.
WHATWG works on web forms and applications, while W3C focuses on XHTML 2.0. In 2006, the two parties decided to collaborate 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 markup to replace scripts
HTML5 should be device independent
The development process should be transparent to the public

The simplest HTML5 document

XML/HTML CodeCopy content to clipboard
  1. span>>
  2. title>A Tiny HTML Documenttitle>
  3. p>Let's rock the browser, HTML5 style.< ;/p> 

A super simple HTML5 document containing only one line of text. It looks like this in the browser:


The more common structure uses

and to separate the information of the page from the actual content of the page, and uses to encapsulate the entire document , the current document looks like this:
XML/HTML CodeCopy content to clipboard
  1. span>>
  2. html>
  3. head>
  4. title>A Tiny HTML Documenttitle>
  5. head>
  6. body>
  7. p>Let's rock the browser, HTML5 style.< ;/p> 
  8. body>
  9. html>

,

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

HTML5 Document Type

XML/HTML CodeCopy content to clipboard
  1. /span>>


The first line must be a specific document type declaration, which is used to tell which standard the subsequent document markup follows. HTML5's 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 characters you want.

It is very simple to add character encoding information in HTML5. Add the element in

, as follows:
XML/HTML CodeCopy content to clipboard
  1. head>
  2. meta charset="utf- 8"> 
  3. title>A Tiny HTML Documenttitle>
  4. head>


The Dreamweaver design tool automatically adds this metainformation when creating a new web page and also saves the file in UTF encoding. If you are using the simplest text editor, remember to select the correct encoding (UTF-8) when saving.

Page Language

It is a good practice to indicate the natural language used in web pages. To specify a language for content, use the lang attribute on any element.

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

XML/HTML CodeCopy content to clipboard
  1. html lang="zh-CN"> 


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

Add style sheet

As long as it is a professionally designed website, it will definitely use style sheets. When specifying the CSS style sheet to be used, you need to add the element in

, as follows:
XML/HTML CodeCopy content to clipboard
  1. head>
  2. meta charset="utf- 8"> 
  3. title>A Tiny HTML Documenttitle>
  4. link rel="stylesheet" href="TinyHTML5.css">
  5. head>


Add JavaScript

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

XML/HTML CodeCopy content to clipboard
  1. head>
  2. meta charset="utf- 8"> 
  3. title>A Tiny HTML Documenttitle>
  4. link rel="stylesheet" href="TinyHTML5.css">
  5. script src="TinyHTML5. js">script>
  6. head>


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

Special Note:

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

XML/HTML CodeCopy content to clipboard
  1. head>
  2. meta charset="utf- 8"> 
  3. title>A Tiny HTML Documenttitle>


This comment tells IE to treat the page as downloaded from the remote website. Otherwise, IE will switch to a special lock mode and pop up a security warning after you click "Allow blocked content" The JavaScript code will not be executed until after the button is pressed.

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

Final result

A complete and beautiful HTML5 code finally looks like this:

XML/HTML CodeCopy content to clipboard
  1. /span>>
  2. html lang="zh- CN"> 
  3. head>
  4. meta charset="utf- 8"> 
  5. title>A Tiny HTML Documenttitle>
  6. link rel="stylesheet" href="TinyHTML5.css">
  7. script src="TinyHTML5. js">script>
  8. head>
  9. body>
  10. p>Let's rock the browser, HTML5 style.< ;/p> 
  11. body>
  12. html>
Statement
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
Mastering Microdata: A Step-by-Step Guide for HTML5Mastering Microdata: A Step-by-Step Guide for HTML5May 14, 2025 am 12:07 AM

MicrodatainHTML5enhancesSEOanduserexperiencebyprovidingstructureddatatosearchengines.1)Useitemscope,itemtype,anditempropattributestomarkupcontentlikeproductsorevents.2)TestmicrodatawithtoolslikeGoogle'sStructuredDataTestingTool.3)ConsiderusingJSON-LD

What's New in HTML5 Forms? Exploring the New Input TypesWhat's New in HTML5 Forms? Exploring the New Input TypesMay 13, 2025 pm 03:45 PM

HTML5introducesnewinputtypesthatenhanceuserexperience,simplifydevelopment,andimproveaccessibility.1)automaticallyvalidatesemailformat.2)optimizesformobilewithanumerickeypad.3)andsimplifydateandtimeinputs,reducingtheneedforcustomsolutions.

Understanding H5: The Meaning and SignificanceUnderstanding H5: The Meaning and SignificanceMay 11, 2025 am 12:19 AM

H5 is HTML5, the fifth version of HTML. HTML5 improves the expressiveness and interactivity of web pages, introduces new features such as semantic tags, multimedia support, offline storage and Canvas drawing, and promotes the development of Web technology.

H5: Accessibility and Web Standards ComplianceH5: Accessibility and Web Standards ComplianceMay 10, 2025 am 12:21 AM

Accessibility and compliance with network standards are essential to the website. 1) Accessibility ensures that all users have equal access to the website, 2) Network standards follow to improve accessibility and consistency of the website, 3) Accessibility requires the use of semantic HTML, keyboard navigation, color contrast and alternative text, 4) Following these principles is not only a moral and legal requirement, but also amplifying user base.

What is the H5 tag in HTML?What is the H5 tag in HTML?May 09, 2025 am 12:11 AM

The H5 tag in HTML is a fifth-level title that is used to tag smaller titles or sub-titles. 1) The H5 tag helps refine content hierarchy and improve readability and SEO. 2) Combined with CSS, you can customize the style to enhance the visual effect. 3) Use H5 tags reasonably to avoid abuse and ensure the logical content structure.

H5 Code: A Beginner's Guide to Web StructureH5 Code: A Beginner's Guide to Web StructureMay 08, 2025 am 12:15 AM

The methods of building a website in HTML5 include: 1. Use semantic tags to define the web page structure, such as, , etc.; 2. Embed multimedia content, use and tags; 3. Apply advanced functions such as form verification and local storage. Through these steps, you can create a modern web page with clear structure and rich features.

H5 Code Structure: Organizing Content for ReadabilityH5 Code Structure: Organizing Content for ReadabilityMay 07, 2025 am 12:06 AM

A reasonable H5 code structure allows the page to stand out among a lot of content. 1) Use semantic labels such as, etc. to organize content to make the structure clear. 2) Control the rendering effect of pages on different devices through CSS layout such as Flexbox or Grid. 3) Implement responsive design to ensure that the page adapts to different screen sizes.

H5 vs. Older HTML Versions: A ComparisonH5 vs. Older HTML Versions: A ComparisonMay 06, 2025 am 12:09 AM

The main differences between HTML5 (H5) and older versions of HTML include: 1) H5 introduces semantic tags, 2) supports multimedia content, and 3) provides offline storage functions. H5 enhances the functionality and expressiveness of web pages through new tags and APIs, such as and tags, improving user experience and SEO effects, but need to pay attention to compatibility issues.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.