我们如何用 HTML 中的 标签对计算机输出进行格式化?


我们用 <samp> 标签来进行计算机输出格式化。它是一个短语标签。它用于定义和识别计算机程序的示例输出。它将以单类型字体显示 <samp> 元素内部的文本。

语法

<samp>The text…</samp>

示例 1

下面是一个简单的示例,说明如何使用 HTML 中的 <samp> 标签

<html> <head> <meta charset="UTF-8"> <meta name="description" content="meta tag in the web document"> <meta name="keywords" content="HTML,CSS"> <meta name="author" content="lokesh"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <p><b>Pluralsight</b> is the technology workforce development company that helps teams know more and work better together with stronger skills, improved processes</p> <samp> Pluralsight, Inc. is an American privately held online education company that offers a variety of video training courses for software developers </samp> </body> </html>

示例 2

在 HTML 文档中使用此标签的另一个示例是

<html> <head> <title>Title of the document</title> </head> <body> <samp> <h2> HTML document</h2> <p>This is a paragraph.</p> <p>This is another paragraph</p> </samp> </body> </html>

示例 3

我们可以使用样式表覆盖字体样式。

<html> <head> <meta charset="UTF-8"> <meta name="description" content="meta tag in the web document"> <meta name="keywords" content="HTML,CSS"> <meta name="author" content="lokesh"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> samp{ font-family: cursive; } </style> </head> <body> <p><b>Pluralsight</b> is the technology workforce development company that helps teams know more and work better together with stronger skills, improved processes</p> <samp> Pluralsight, Inc. is an American privately held online education company that offers a variety of video training courses for software developers </samp> </body> </html>

更新于: 19-10-2022

180 浏览量

开始你的职业生涯

完成课程以获得认证

开始
广告
© . All rights reserved.