下面的文章提供了 HTML 部分標籤的概述。 HTML 標籤定義文件的部分,例如頁首、章節、頁尾等。標籤將網頁內容分成部分和子部分。它通常在需要兩個頁腳、頁首或任何其他新部分時使用。部分標籤通常會將相關內容的通用區塊進行分組。使用
HTML5中的Section標籤需要同時包含開始和結束標籤,即
文法:
以下是提到的語法:
HTML/XHTML
<body> <section> ... </section> <body>
CSS
section{ --your css code— }
以下是提到的一些屬性:
沒有與
像所有其他 HTML 標籤一樣,
以下是全域屬性:
不存在可與
下面給的是 CSS 文字格式屬性:
下面給的是 CSS 字體屬性:
Given below is the CSS Test Shadow Property:
<style> address{ text-shadow: 1px 1px #FF0000; } </style>
Given below are the examples of HTML section Tag:
Code:
<!DOCTYPE html> <html> <head> <title>Section tag</title> </head> <body> <section> <h1>eduCBA: Article 1</h1> <p>Content of Article 1</p> </section> <section> <h1>eduCBA: Article 2</h1> <p>Content of Article 2</p> </section> <section> <h1>eduCBA: Article 3</h1> <p>Content of Article 3</p> </section> </body> </html>
Output:
Nested Section Tag.
The
Code:
<!DOCTYPE html> <html> <head> <title>Section tag</title> </head> <body> <section> <h1>eduCBA: Article 1</h1> <p>Content of Article 1</p> <section> <h1>Subsection</h1> <h1>Subsection</h1> </section> </section> <section> <h1>eduCBA: Article 2</h1> <p>Content of Article 2</p> <section> <h1>Subsection</h1> <h1>Subsection</h1> </section> </section> <section> <h1>eduCBA: Article 3</h1> <p>Content of Article 3</p> <section> <h1>Subsection</h1> <h1>Subsection</h1> </section> </section> </body> </html>
Output:
Code:
<!DOCTYPE html> <html> <head> . . . </head> <body> <header> <h1>HTML Section tag example</h1> </header> <main> <article> An article on HTML Section tag</article> </main> <aside> Body of an article </aside> <footer> <section>Copyright ©2020- EDUCBA.</section> <address> A- 406, Boomerang, Chandivali Farm Road, Yadav Nagar, Chandivali, Powai, Maharashtra, Mumbai - 400072. </address> </footer> </body> </html>
Output:
Code:
<!DOCTYPE> <html> <head> <style> section{ border:1px solid pink; padding:15px; margin:10px; } </style> </head> <body> <h2> List of Articles</h2> <section> <h3>Article 1 heading</h3> <p> Body of article </p> </section> <section> <h3>Article 2 heading</h3> <p> Body of article </p> </section> <section> <h3>Article 3 heading</h3> <p> Body of article </p> </section> </body> </html>
Output:
While creating a
The section should always have a header element (H1 to H6). If a title cannot be given for the section, we can use the
Code:
<!DOCTYPE> <html> <head> <style> section{ border:1px solid pink; padding:15px; margin:10px; } </style> </head> <body> <section id="sectiontag" class="sectionclass"> <h2>HTML Section tag</h2> <p>Random text Random text Random text...</p> </section> <section id="articletag"> <h2>HTML Article tag</h2> <p>Random text Random text Random text...</p> </section> <section id="footertag"> <h2>HTML Footer tag</h2> <p>Random text Random text Random text...</p> </section> </body> </html>
Output:
The
以上是HTML 部分標籤的詳細內容。更多資訊請關注PHP中文網其他相關文章!