title | slug |
---|---|
<samp> |
Web/HTML/Element/samp |
{{HTMLSidebar}}
<samp> 元素用于标识计算机程序输出,通常使用浏览器缺省的 monotype 字体(例如 Lucida Console)。
内容分类 | Flow content, phrasing content, palpable content. |
---|---|
允许内容 | Phrasing content. |
标签省略 | 不允许,开始标签和结束标签都不能省略。 |
允许的父级元素 | Any element that accepts phrasing content. |
DOM 接口 | {{domxref("HTMLElement")}} |
该元素只包含 全局属性。
该元素实现了 HTMLElement
接口。
Note
基于 Gecko 1.9.2 及以上,Firefox 还为该元素实现了HTMLSpanElement 接口。
<p>Regular text. <samp>This is sample text.</samp> Regular text.</p>
Regular text. This is sample text.
Regular text.
{{Specifications}}
可以使用 CSS 选择器 samp
定义规则来覆盖浏览器的缺省字体。不过,用户设置的偏好可能会优先于指定的 CSS 使用。