HTML <aside>
标签用于表示文档中与主内容间接相关的部分。它最常用于文档的侧边栏。它在浏览器中不会渲染任何特殊效果。例如,
<div>
<h1>This is a heading</h1>
<aside>
<p>This is a paragraph</p>
</aside>
</div>
浏览器输出

在此,<aside>
元素包含一个与 <h1>
元素间接相关的段落。
CSS 与 HTML <aside>
我们使用 CSS 来设置 HTML <aside>
的样式。例如,
<aside>
<h2>Sidebar</h2>
<p>This is some content in the sidebar.</p>
</aside>
<main>
<h1>Main Content</h1>
<p>This is the main content of the page.</p>
</main>
<style>
main {
padding: 10px;
margin: 10px;
}
aside {
width: 200px;
border: 1px solid black;
padding: 10px;
margin: 10px;
float: left;
}
</style>
浏览器输出
