我們如何用 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>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP