<aside>:側邊欄元素

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

<aside> HTML 元素代表文件中只間接相關於主要內容的部分。側邊欄常常被呈現為側邊欄或呼叫框。

嘗試一下

<p>
  Salamanders are a group of amphibians with a lizard-like appearance, including
  short legs and a tail in both larval and adult forms.
</p>

<aside>
  <p>The Rough-skinned Newt defends itself with a deadly neurotoxin.</p>
</aside>

<p>
  Several species of salamander inhabit the temperate rainforest of the Pacific
  Northwest, including the Ensatina, the Northwestern Salamander and the
  Rough-skinned Newt. Most salamanders are nocturnal, and hunt for insects,
  worms and other small creatures.
</p>
aside {
  width: 40%;
  padding-left: 0.5rem;
  margin-left: 0.5rem;
  float: right;
  box-shadow: inset 5px 0 5px -5px #29627e;
  font-style: italic;
  color: #29627e;
}

aside > p {
  margin: 0.5rem;
}

屬性

這個元素只包括全域屬性

使用注意事項

  • 請勿使用 <aside> 元素來標記括號中的文字,因為這種文字被視為主要內容的一部分。

範例

使用 <aside>

這個範例使用 <aside> 來標記文章中的一段落。這段落與主要文章內容只間接相關:

html
<article>
  <p>
    The Disney movie <cite>The Little Mermaid</cite> was first released to
    theatres in 1989.
  </p>
  <aside>
    <p>The movie earned $87 million during its initial release.</p>
  </aside>
  <p>More info about the movie…</p>
</article>

結果

技術摘要

內容類型 流內容章節型內容捫及內容
允許內容 流內容
標籤省略 不允許,開始和結束標籤都是必須的。
允許的父元素 任何接受流內容的元素。請注意,<aside> 元素不能是 <address> 元素的後代。
隱含的 ARIA 角色 complementary
允許的 ARIA 角色 feednonenotepresentationregionsearch
DOM 介面 HTMLElement

規範

Specification
HTML
# the-aside-element

瀏覽器相容性

BCD tables only load in the browser

參見