用于定义文档中的节(section)。当在网页上放置内容时,可能会包含许多章节、标题、页脚或其他节(section),这就是使用 HTML <section> 标签的原因。

HTML <section> 是在 HTML5 中引入的新标签。

HTML <section> 标签示例

CSS 代码:

section {
  border: 1px solid pink;
  padding: 15px;
  margin: 10px;
}

HTML 代码:

<h2>Indian Leader</h2>
<section>
  <h3>Jawaharlal Nehru</h3>
  <p>Jawaharlal Nehru was the first Prime Minister of India and a central figure in Indian politics for much of the 20th century. He emerged as the paramount leader of the Indian independence movement under the tutelage of Mahatma Gandhi. - Source Wikipedia</p>
</section>
<section>
  <h3>Subhas Chandra Bose</h3>
  <p>Subhas Chandra Bose was an Indian nationalist whose attempt during World War II to rid India of British rule with the help of Nazi Germany and Japan left a troubled legacy. The honorific Netaji (Hindustani language: "Respected Leader"), first applied to Bose in Germany, by the Indian soldiers of the Indische Legion and by the German and Indian officials in the Special Bureau for India in Berlin, in early 1942, is now used widely throughout India. - Source Wikipedia</p>
</section>

输出:

Indian Leader

Jawaharlal Nehru

Jawaharlal Nehru was the first Prime Minister of India and a central figure in Indian politics for much of the 20th century. He emerged as the paramount leader of the Indian independence movement under the tutelage of Mahatma Gandhi. - Source Wikipedia

Subhas Chandra Bose

Subhas Chandra Bose was an Indian nationalist whose attempt during World War II to rid India of British rule with the help of Nazi Germany and Japan left a troubled legacy. The honorific Netaji (Hindustani language: "Respected Leader"), first applied to Bose in Germany, by the Indian soldiers of the Indische Legion and by the German and Indian officials in the Special Bureau for India in Berlin, in early 1942, is now used widely throughout India. - Source Wikipedia

<section> 标签在 HTML5 中支持全局属性和事件属性。

支持使用 HTML <section> 标签的浏览器有:

元素ChromeIEFirefoxOperaSafari
<section>

标签: html, HTML教程, HTML技术, HTML学习, HTML学习教程, HTML下载, HTML语言, HTML开发, HTML入门教程, HTML进阶教程, HTML面试题, HTML笔试题, HTML编程思想