- Mastering Responsive Web Design
- Ricardo Zea
- 187字
- 2021-07-16 20:33:20
The <section> element
The HTML Section Element (
<section>
) represents a generic section of a document, i.e., a thematic grouping of content, typically with a heading. Each<section>
should be identified, typically by including a heading(<h1>
-<h6>
element) as a child of the<section>
element.
Here are a few important points to remember about the <section>
element:
- The
<section>
element can be used to encapsulate a group of related content. This related content doesn't necessarily have to make sense if we take it out of the page's context. - A safe and valid way to use the
<section>
element is to place it inside an<article>
element. You can certainly use the<article>
element without a<section>
element. It's recommended, although not required, to include a heading element(<h1>
,<h2>
,<h3>
, and so on) when using the<section>
element. - It can be confusing to know when to use the
<section>
element and when to use the<article>
element. If you're in doubt, you can choose either element. - There can be more than one
<section>
in a single page.
Consider the following example:
<body> <main class="main-container" role="main"> <article class="article-container flex-container"> <section class="main-content"> <header> <h1>The <code><main></code> element </h1> </header> <p>As per the MDN definition:</p> <blockquote> <p>The HTML Main Element (<code><main></code>) represents…</p> </blockquote> </section> </article> </main> </body>
推薦閱讀
- Visual C++程序設(shè)計(jì)教程
- Getting Started with React
- Learning PostgreSQL
- 構(gòu)建移動(dòng)網(wǎng)站與APP:HTML 5移動(dòng)開(kāi)發(fā)入門(mén)與實(shí)戰(zhàn)(跨平臺(tái)移動(dòng)開(kāi)發(fā)叢書(shū))
- aelf區(qū)塊鏈應(yīng)用架構(gòu)指南
- Python Data Analysis(Second Edition)
- PHP+MySQL+Dreamweaver動(dòng)態(tài)網(wǎng)站開(kāi)發(fā)實(shí)例教程
- Oracle實(shí)用教程
- Oracle 12c從入門(mén)到精通(視頻教學(xué)超值版)
- Qt 4開(kāi)發(fā)實(shí)踐
- Getting Started with Windows Server Security
- 大話C語(yǔ)言
- Hands-On Data Visualization with Bokeh
- 秒懂算法:用常識(shí)解讀數(shù)據(jù)結(jié)構(gòu)與算法
- Java程序設(shè)計(jì)基礎(chǔ)教程