w3schools 系列教程之 HTML 介绍_html/css_WEB-ITnose
HTML 是一种描述 Web 文档(页面)的标记语言。
- HTML 代表超文本标记语言(Hyper Text Markup Language)
- 标记语言就是一组标记标签
- HTML 文档是由 HTML 标签来描述的
- 每个 HTML 标记描述了不同的文档内容
HTML 示例代码
<!DOCTYPE html><html> <head> <title>Page Title</title> </head> <body> <h1 id="My-First-Heading">My First Heading</h1> <p>My first paragraph.</p> </body></html>
示例代码解释
- DOCTYPE 声明定义将 HTML 文档类型
- 和 标签之间的文本描述了一个 HTML 文档
- 和 标签之间的文本提供了有关 HTML 文档的信息
-
和 标签之间的文本提供了有关 HTML 文档的标题 - 和 标签之间的文本描述了可见的 HTML 文档内容
-
和
标签之间的文本描述了标题 -
和
标签之间的文本描述了段落
通过使用这些描述,浏览器可以显示一个 HTML 文档的标题和段落。
HTML 标签
HTML 标签是包含了一对尖角号的关键词(标签名称):
<tagname>content</tagname>
- HTML 标签通常是成对的,比如
和
- 一对标签中的第一个标签是开始标签,第二个是结束标签
- 结束标签像开始标签一样编写,只是在标签名称的前面有一个斜杠
开始标签也可以叫做打开标签,结束标签也可以叫做关闭标签。
Web 浏览器
一个 Web 浏览器的作用是读取并显示一个 HTML 文档。一个 Web 浏览器不显示 HTML 标签,而是通过它们来确定如何显示 HTML 文档。
HTML 页面结构
下面是一个 HTML 页面结构的示例:
<html> <head> <title>Page title</title> </head> <body> <h1 id="This-is-a-heading">This is a heading</h1> <p>This is a paragraph.</p> <p>This is another paragraph.</p> </body></html>
浏览器只显示
标签区域内的内容。声明
声明有助于浏览器能够正确地显示 HTML 页面。
网络中具有不同的文档类型。
想要正确地显示 HTML 文档,浏览器必须要知道 HTML 文档的类型和版本。
声明是不区分大小写的,以下所有写法都是正确地:
<!DOCTYPE html><!DOCTYPE HTML><!doctype html><!Doctype Html>
常见声明
HTML5
<!DOCTYPE html>
HTML 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
HTML 版本
在网络的早期,HTML 就具有了很多版本:
版本 | 年份 |
---|---|
HTML | 1991 |
HTML 2.0 | 1995 |
HTML 3.2 | 1997 |
HTML 4.01 | 1999 |
XHTML | 2000 |
HTML5 | 2014 |
本文翻译于《w3schools》网站提供的 HTML 教程。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.
