搜尋
首頁web前端html教學HTML 部分標籤

HTML 部分標籤

Sep 04, 2024 pm 04:31 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

下面的文章提供了 HTML 部分標籤的概述。 HTML 標籤定義文件的部分,例如頁首、章節、頁尾等。標籤將網頁內容分成部分和子部分。它通常在需要兩個頁腳、頁首或任何其他新部分時使用。部分標籤通常會將相關內容的通用區塊進行分組。使用

的主要優點是標籤的特徵是它是一個語義元素,向開發者和瀏覽器描述其含義。

版塊標籤需要注意的重點

HTML5中的Section標籤需要同時包含開始和結束標籤,即

……..

  • 標籤用於將內容分為兩部分,即它分佈節和子節。
  • 節標籤允許的內容類型是流內容,意味著;作為父標籤,不能嵌套
    標籤。元素;然後相同的內容不能有 標籤作為其父級;分段內容和可觸摸內容。
  • 元素不能是
    的後代。元素。
  • 每個應透過引入標題標籤作為
    的子標籤來視覺化。元素。
  • 如果我們需要聯合
    的內容;單獨的元素,那麼我們可以使用
    ;來取代標籤。
  • 元素不應該被用作通用容器;這就是
    的內容是為了,特別是當切片僅用於樣式目的時。經驗法則是
    標籤邏輯上應該出現在文件的大綱上。
  • 元素是語義元素,它提供有關所包含內容的含義,重點關注人類和用戶代理的文檔部分。它是一個通用語義元素,因此當沒有其他語義容器元素(article、aside 和 nav)合適時,應該使用它。
  • 文法:

    以下是提到的語法:

    HTML/XHTML

    <section> ... </section>
    

    CSS

    section{
    --your css code—
    }

    Html 部分標籤的屬性

    以下是提到的一些屬性:

    1.標籤特定屬性

    沒有與

    一起使用的特定屬性標籤。

    2.全域屬性

    像所有其他 HTML 標籤一樣,

    標籤也支援HTML5中的全域屬性。

    以下是全域屬性:

    • 中止
    • 自動完成
    • 自動完成錯誤
    • onblur
    • 取消
    • 可以玩
    • 可以通關
    • onchange
    • 點選
    • 關閉
    • 上下文選單
    • 提示改變
    • 點選
    • ondrag
    • ondragend
    • ondragenter
    • 關於dragage退出
    • 拖曳離開
    • ondragover
    • ondragstart
    • ondrop
    • 持續時間變化
    • 已清空
    • 已結束
    • 錯誤
    • 焦點
    • 輸入
    • 無效
    • 按下按鍵
    • 按鍵
    • onkeyup
    • 載入
    • 已載入資料
    • 已載入元資料
    • onloadstart
    • 滑鼠按下
    • 滑鼠輸入
    • 滑鼠離開
    • 滑鼠移動
    • 滑鼠移出
    • 滑鼠懸停
    • 滑鼠鬆開
    • 滑鼠滾輪
    • 暫停
    • 比賽中
    • 正在播放
    • 進行中
    • 匯率變動
    • 重置
    • 調整大小
    • 捲動
    • 尋求
    • 尋求
    • 選擇
    • 現場表演
    • onsort
    • 已安裝
    • 提交
    • 暫停
    • 準時更新
    • 開啟
    • 音量變化
    • 等待中

    3.事件屬性

    不存在可與

    一起使用的事件屬性標籤。

    中的 CSS 文字格式屬性標籤

    下面給的是 CSS 文字格式屬性:

    • 文字顏色
    • 文字對齊
    • 文字裝飾
    • 文字轉換
    • 行高
    • 文字方向
    • 文字陰影
    • 字間距

    中的 CSS 字體屬性標籤

    下面給的是 CSS 字體屬性:

    • font-style: normal|italic|oblique|initial|inherit
    • font-variant: normal|small-caps|initial|inherit
    • font-weight: normal|bold|bolder|lighter|number|initial|inherit
    • font-size: medium|xx-small|x-small|small|large|x-large|xx-large|smaller|larger|length|initial|inherit
    • font-family: family-name|generic-family|initial|inherit

    CSS Test Shadow Property for
    Tag

    Given below is the CSS Test Shadow Property:

    <style>
    address{
    text-shadow: 1px 1px #FF0000;
    }
    </style>

    Examples of HTML section Tag

    Given below are the examples of HTML section Tag:

    Example #1

    Code:

    
    
    <title>Section tag</title>
    
    
    <section>
    <h1 id="eduCBA-Article">eduCBA: Article 1</h1>
    <p>Content of Article 1</p>
    </section>
    <section>
    <h1 id="eduCBA-Article">eduCBA: Article 2</h1>
    <p>Content of Article 2</p>
    </section>
    <section>
    <h1 id="eduCBA-Article">eduCBA: Article 3</h1>
    <p>Content of Article 3</p>
    </section>
    
    

    Output:

    HTML 部分標籤

    Example #2

    Nested Section Tag.

    The

    tag can be nested wherein the font size of the subsection is smaller than the section only if both have the same font properties. The subsection is used for organizing complex data.

    Code:

    
    
    <title>Section tag</title>
    
    
    <section>
    <h1 id="eduCBA-Article">eduCBA: Article 1</h1>
    <p>Content of Article 1</p>
    <section>
    <h1 id="Subsection">Subsection</h1>
    <h1 id="Subsection">Subsection</h1>
    </section>
    </section>
    <section>
    <h1 id="eduCBA-Article">eduCBA: Article 2</h1>
    <p>Content of Article 2</p>
    <section>
    <h1 id="Subsection">Subsection</h1>
    <h1 id="Subsection">Subsection</h1>
    </section>
    </section>
    <section>
    <h1 id="eduCBA-Article">eduCBA: Article 3</h1>
    <p>Content of Article 3</p>
    <section>
    <h1 id="Subsection">Subsection</h1>
    <h1 id="Subsection">Subsection</h1>
    </section>
    </section>
    
    

    Output:

    HTML 部分標籤

    Example #3

    Code:

    
     . . . 
    
    <header>
    <h1 id="HTML-Section-tag-example">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>
    
    

    Output:

    HTML 部分標籤

    Example #4

    Code:

    
    
    <style section border:1px solid pink padding:15px margin:10px>
    
    <body>
    <h2> List of Articles
    <section>
    <h3>Article 1 heading
    <p> Body of article 
    </style>

    Article 2 heading

    Body of article

    Article 3 heading

    Body of article

    Output:

    HTML 部分標籤

    Example #5

    While creating a

    tag in HTML5, we can use either the class or id attributes wherein each id should be unique, and the class can be used multiple times when necessary.

    The section should always have a header element (H1 to H6). If a title cannot be given for the section, we can use the

    element, which will probably be more appropriate, and always never use the
    tag just for putting styles.

    Code:

    
    
    <style>
    section{
    border:1px solid pink;
    padding:15px;
    margin:10px;
    }
    </style>
    
    
    <section id="sectiontag" class="sectionclass">
    <h2 id="HTML-Section-tag">HTML Section tag</h2>
    <p>Random text Random text Random text...</p>
    </section>
    <section id="articletag">
    <h2 id="HTML-Article-tag">HTML Article tag</h2>
    <p>Random text Random text Random text...</p>
    </section>
    <section id="footertag">
    <h2 id="HTML-Footer-tag">HTML Footer tag</h2>
    <p>Random text Random text Random text...</p>
    </section>
    
    

    Output:

    HTML 部分標籤

    Conclusion

    The

    element is a structural HTML element that groups all the related elements. Each
    usually includes one or more heading elements and additional elements presenting related content.
    is a new HTML5 element used to define an important document section. It is better to use it within articles, to define navigation, or in the header or footer. If a section of the content deserves its heading, which would be listed in a theoretical or actual table of contents, it should be placed as a
    .

以上是HTML 部分標籤的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
HTML的未來:進化和趨勢HTML的未來:進化和趨勢May 13, 2025 am 12:01 AM

HTML的未來將朝著更加語義化、功能化和模塊化的方向發展。 1)語義化將使標籤更明確地描述內容,提升SEO和無障礙訪問。 2)功能化將引入新元素和屬性,滿足用戶需求。 3)模塊化將支持組件化開發,提高代碼復用性。

為什麼HTML屬性對Web開發很重要?為什麼HTML屬性對Web開發很重要?May 12, 2025 am 12:01 AM

htmlattributesarecrucialinwebdevelopment forcontrollingBehavior,外觀和功能

Alt屬性的目的是什麼?為什麼重要?Alt屬性的目的是什麼?為什麼重要?May 11, 2025 am 12:01 AM

alt屬性是HTML中標籤的重要部分,用於提供圖片的替代文本。 1.當圖片無法加載時,alt屬性中的文本會顯示,提升用戶體驗。 2.屏幕閱讀器使用alt屬性幫助視障用戶理解圖片內容。 3.搜索引擎索引alt屬性中的文本,提高網頁的SEO排名。

HTML,CSS和JavaScript:示例和實際應用HTML,CSS和JavaScript:示例和實際應用May 09, 2025 am 12:01 AM

HTML、CSS和JavaScript在網頁開發中的作用分別是:1.HTML用於構建網頁結構;2.CSS用於美化網頁外觀;3.JavaScript用於實現動態交互。通過標籤、樣式和腳本,這三者共同構築了現代網頁的核心功能。

如何在標籤上設置lang屬性?為什麼這很重要?如何在標籤上設置lang屬性?為什麼這很重要?May 08, 2025 am 12:03 AM

設置標籤的lang屬性是優化網頁可訪問性和SEO的關鍵步驟。 1)在標籤中設置lang屬性,如。 2)在多語言內容中,為不同語言部分設置lang屬性,如。 3)使用符合ISO639-1標準的語言代碼,如"en"、"fr"、"zh"等。正確設置lang屬性可以提高網頁的可訪問性和搜索引擎排名。

HTML屬性的目的是什麼?HTML屬性的目的是什麼?May 07, 2025 am 12:01 AM

htmlattributeseresene forenhancingwebelements'functionalityandAppearance.TheyAdDinformationTodeFineBehavior,外觀和互動,使網站互動,響應式,visalalyAppealing.AttributesLikutesLikeSlikEslikesrc,href,href,href,類,類型,類型,和dissabledtransfransformformformformformformformformformformformformformformforment

您如何在HTML中創建列表?您如何在HTML中創建列表?May 06, 2025 am 12:01 AM

toCreateAlistInHtml,useforforunordedlistsandfororderedlists:1)forunorderedlists,wrapitemsinanduseforeachItem,RenderingeringAsabulletedList.2)fororderedlists,useandfornumberedlists,useandfornumberedlists,casundfornumberedlists,casundfornthetthetthetthetthetthetthetttributefordforderfordforderforderentnumberingsnumberingsnumberingStys。

HTML行動:網站結構的示例HTML行動:網站結構的示例May 05, 2025 am 12:03 AM

HTML用於構建結構清晰的網站。 1)使用標籤如、、定義網站結構。 2)示例展示了博客和電商網站的結構。 3)避免常見錯誤如標籤嵌套不正確。 4)優化性能通過減少HTTP請求和使用語義化標籤。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)