試一試
<article>
<h1>How to be a wizard</h1>
<ol>
<li>Grow a long, majestic beard.</li>
<li>Wear a tall, pointed hat.</li>
<li>Have I mentioned the beard?</li>
</ol>
<footer>
<p>© 2018 Gandalf</p>
</footer>
</article>
article {
min-height: 100%;
display: grid;
grid-template-rows: auto 1fr auto;
}
footer {
display: flex;
justify-content: center;
padding: 5px;
background-color: #45a1ff;
color: white;
}
屬性
此元素僅包含全域性屬性。
用法說明
無障礙
在 Safari 13 釋出之前,contentinfo 地標角色並未被 VoiceOver 正確公開。如果需要支援舊版 Safari 瀏覽器,請將 role="contentinfo" 新增到 footer 元素,以確保地標能夠正確公開。
示例
html
<body>
<h3>FIFA World Cup top goalscorers</h3>
<ol>
<li>Miroslav Klose, 16</li>
<li>Ronaldo Nazário, 15</li>
<li>Gerd Müller, 14</li>
</ol>
<footer>
<small>
Copyright © 2023 Football History Archives. All Rights Reserved.
</small>
</footer>
</body>
css
footer {
text-align: center;
padding: 5px;
background-color: #abbaba;
color: black;
}
技術摘要
| 內容類別 | 流內容,可感知內容。 |
|---|---|
| 允許內容 |
流內容,但沒有 <footer> 或 <header> 後代。 |
| 標籤省略 | 無,起始標籤和結束標籤都必須存在。 |
| 允許父級 | 接受 流內容的任何元素。請注意,<footer> 元素不能是 <address>、<header> 或另一個 <footer> 元素的後代。 |
| 隱式 ARIA 角色 |
contentinfo,或者如果它是 article、aside、main、nav 或 section 元素的後代,則為 generic,或帶有 article、complementary、main、navigation 或 region 角色的元素。 |
| 允許的 ARIA 角色 |
group、presentation 或 none |
| DOM 介面 | HTMLElement |
規範
| 規範 |
|---|
| HTML # the-footer-element |
瀏覽器相容性
載入中…