Table of Contents
HTML 示例代码
My First Heading
示例代码解释
HTML 标签
Web 浏览器
HTML 页面结构
This is a heading
声明
常见声明
HTML 4.01
XHTML 1.0
HTML 版本
Home Web Front-end HTML Tutorial w3schools 系列教程之 HTML 介绍_html/css_WEB-ITnose

w3schools 系列教程之 HTML 介绍_html/css_WEB-ITnose

Jun 21, 2016 am 08:48 AM

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>
Copy after login

示例代码解释

  • DOCTYPE 声明定义将 HTML 文档类型
  • 和 标签之间的文本描述了一个 HTML 文档
  • 和 标签之间的文本提供了有关 HTML 文档的信息
  • 标签之间的文本提供了有关 HTML 文档的标题
  • 和 标签之间的文本描述了可见的 HTML 文档内容
  • 标签之间的文本描述了标题
  • 标签之间的文本描述了段落

通过使用这些描述,浏览器可以显示一个 HTML 文档的标题和段落。

HTML 标签

HTML 标签是包含了一对尖角号的关键词(标签名称):

<tagname>content</tagname>
Copy after login

  • 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>
Copy after login

浏览器只显示 标签区域内的内容。

声明

声明有助于浏览器能够正确地显示 HTML 页面。

网络中具有不同的文档类型。

想要正确地显示 HTML 文档,浏览器必须要知道 HTML 文档的类型和版本。

声明是不区分大小写的,以下所有写法都是正确地:

<!DOCTYPE html><!DOCTYPE HTML><!doctype html><!Doctype Html>
Copy after login

常见声明

HTML5

<!DOCTYPE html>
Copy after login

HTML 4.01

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Copy after login

XHTML 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Copy after login

HTML 版本

在网络的早期,HTML 就具有了很多版本:

版本 年份
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML5 2014

本文翻译于《w3schools》网站提供的 HTML 教程。

Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

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

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

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

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

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

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

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.

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

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.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

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

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

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.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles