TOC

This article is currently in the process of being translated into Chinese (~94% done).

HTML Basics:

Headings

标题用 <h1> 到 <h6> 元素定义,<h1> 是页面上最重要的标题。

以下是不同标题的一些示例

<h1>This is a H1-heading</h1>
<h3>This is a H3-heading</h3>
<h6>This is a H6-heading</h6>

标题很重要,因为网络浏览器将标题解释为页面的结构。因此,标题应该只用于实际标题,而不是使文本变粗或变大。除了结构化页面之外,标题还可以提高页面的可读性——您的用户很可能会浏览您的页面并将标题用作导航。

下面是如何使用不同标题的示例。标题用于概述页面 - 以下 HTML 将创建此页面结构:

  1. 介绍
  2. 返回二级标题
  3. 最后 2 级标题
<!DOCTYPE html>
<html>
<head>
	<title>Your first HTML5 Document</title>
</head>
<body>
	<h1>Introduction</h1>
		<p>Okay, now we’re going somewhere! This is the first paragraph of the page.</p>
	<h2>The less important heading</h2>
		<p>This is the second paragraph and it is right below a h2-heading</p>
	<h3>My 3rd level heading</h3>
		<p>Just another paragraph </p>
	<h2>Back to 2nd level headings</h2>
	<h2>The last 2nd level heading</h2>
</body>
</html>

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!
adplus-dvertising