我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

The HTML <samp> element is an element intended to identify sample output from a computer program. It is usually displayed in the browser's default monotype font (such as Lucida Console).

Content categories Flow content, phrasing content, palpable content.
Permitted content Phrasing content.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parents Any element that accepts phrasing content.
Permitted ARIA roles Any
DOM interface HTMLElement

Attributes

This element only includes the global attributes.

Example

Regular text, followed by sample output, and then regular text again.

<p>The diet-tracking app said: <samp>You're not eating your veggies</samp> and that was true</p>

Result

The diet-tracking app said: You're not eating your veggies. and that was true.

Specifications

Specification Status Comment
HTML Living Standard
The definition of '<samp>' in that specification.
Living Standard  
HTML5
The definition of '<samp>' in that specification.
Recommendation  
HTML 4.01 Specification
The definition of '<samp>' in that specification.
Recommendation  

Note

A CSS rule can be defined for the samp selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes Yes1 Yes Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic support Yes Yes Yes4 Yes Yes Yes

See also

文件標籤與貢獻者

 最近更新: teoli,