試一試
<p>
The <code>push()</code> method adds one or more elements to the end of an
array and returns the new length of the array.
</p>
code {
background-color: #eeeeee;
border-radius: 3px;
font-family: "Courier New", monospace;
padding: 0 3px;
}
屬性
此元素僅包含全域性屬性。
示例
包含 <code> 的一段文字
html
<p>
The function <code>selectAll()</code> highlights all the text in the input
field so the user can, for example, copy or delete the text.
</p>
結果
注意
要表示多行程式碼,請將 <code> 元素巢狀在 <pre> 元素中。單獨的 <code> 元素僅表示一個程式碼短語或一行程式碼。
可以使用 CSS 規則為 code 選擇器定義樣式,以覆蓋瀏覽器預設的字型。使用者設定的偏好可能會覆蓋指定的 CSS。
技術摘要
| 內容類別 | 流式內容、語句內容、明顯內容。 |
|---|---|
| 允許內容 | 短語內容. |
| 標籤省略 | 無,起始標籤和結束標籤都必須存在。 |
| 允許父級 | 任何接受短語內容的元素。 |
| 隱式 ARIA 角色 |
code
|
| 允許的 ARIA 角色 | 任意 |
| DOM 介面 |
HTMLElement 直到 Gecko 1.9.2(Firefox 4)及之前版本,Firefox 都為此元素實現了 HTMLSpanElement 介面。 |
規範
| 規範 |
|---|
| HTML # the-code-element |
瀏覽器相容性
載入中…