HTML 中的字型標籤
html
html5
HTML Tutorial
HTML Properties
HTML tags
HTML 中的字型標籤是用來使網頁或 HTML 文件更具吸引力的最重要屬性之一。它具有更改所包含文字的大小、顏色和樣式的屬性。借助字體標籤,可以使網頁的大小、顏色和外觀採用相同的文字格式。此標籤主要作用於尺寸、面或類型和顏色等三個主要屬性。字體標籤作為 HTML 中的內嵌元素來變更 HTML 文件中區塊文字的某些功能。 內包含的文字標籤用於定義其中所包含的文字的樣式。
文法:
<font size =" " face =" " color=" ">
登入後複製
- 以上語法狀態,字體大小是語法中的屬性,用來設定文字的具體大小。該大小可以定義為 1 到 7 之間的數字,其中 1 表示最小文本,7 表示最大文本大小。字型標籤中的face屬性用於定義HTML文件中的字型類型,而color屬性用於定義所包含文字的特定顏色。
- HTML ; 中使用的標籤標籤。它是使用 .. 定義的HTML 中的標籤。
<body> <p> <font size="2" color="blue" face="Calibri"> </font> </p> </body>
登入後複製
此標籤也支援全域屬性和事件屬性。此外,它還支援一些其他屬性,如下所示:
Attribute Name | Detail Description |
Size | This attribute is used to define a specific size for text in between 1 to 7. |
Face or type | This attribute is used to define the font type for the included text. |
Color | This attribute is used to show enclosed text in a different color. |
Weight | This attribute defines the boldness of the text of the font tag. |
字體標籤在 HTML 程式碼中可以透過兩種方式使用,第一種是透過 HTML 包含字體標籤及其屬性值,第二種是使用定義屬性值作為 CSS 程式碼。兩者都會產生相同的輸出。唯一的差別在於定義屬性值。
範例#1
定義字型標籤及其屬性值:
<!DOCTYPE html> <html> <head> <title>Font Tag in HTML</title> </head> <body> <h2>Example of Font Tag in HTML </h2> <p>General text without any Font tag attribute value</p> <p> <font color="orange">Text having normal font size and font face . Only changing font color </font> </p> <p> <font face="cursive">Text having different font face.</font> </p> <p> <font size="3">Text with Increased font size having default font type. </font> </p> </body> </html>
登入後複製
輸出:
範例#2
定義字體標籤,其屬性值透過CSS定義:
<!DOCTYPE html> <html> <head> <title>Font Tag in HTML</title> </head> <body> <h2>Example of Font Tag in HTML using CSS </h2> <p>Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> <p style="color : lightgreen;"> Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> <p style="font-family : Book Antiqua; color: blue; " > Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> <p style="font size:3px;"> Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> </body> </html>
登入後複製
輸出:
範例 #3
在此範例中,我們使用具有屬性值 size 的 Font 標籤,它將定義從最小尺寸到最大尺寸的文本,如下所示:
<!DOCTYPE html> <html> <head> <title>HTML font tag</title> </head> <body> <font size = "1">People may doubt what you say, but they will believe what you do.</font><br /> <br/> <font size = "2">People may doubt what you say, but they will believe what you do.</font><br /> <br/> <font size = "3">People may doubt what you say, but they will believe what you do.</font><br /> <br/> <font size = "4">People may doubt what you say, but they will believe what you do.</font><br /> <br/> <font size = "5">People may doubt what you say, but they will believe what you do.</font><br /> <br/> <font size = "6">People may doubt what you say, but they will believe what you do.</font><br/><br/> <font size = "7">People may doubt what you say, but they will believe what you do.</font> </body> </html>
登入後複製
輸出:
範例#4
<!DOCTYPE html> <html> <head> <title>HTML tag with Font Type attribute</title> </head> <body> <font face = "Comic sans MS"> Correct one fault at a time. Concentrate on the one fault you want to overcome.</font><br/> <font face = "Bernard MT Condensed" color="Red" >Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/> <font face = "Algerian">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/> <font face = "Book Antiqua" size="5">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/> <font face = "Aharoni"> Correct one fault at a time. Concentrate on the one fault you want to overcome.</font><br/> <font face = "AR BERKLEY" >Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/> </body> </html>
登入後複製
輸出:
範例#5
<!DOCTYPE html> <html> <head> <title>HTML Font tag-Color </title> </head> <body> <font color = "#cc0066"><b>It is terrible thing to see and have no vision</b></font><br> <font color = "#66ff33"><b>Today's preparation </b></font> <br> <font color = "#0000cc"><strong>Success depends on your backbone not your wishbone.</strong></font><br /> <font color = "#cc3300"><b>Patience makes lighter what sorrow may not heal</b></font> <br> <font color = "#666600"><b>Hold fast to dreams, for if dreams die, life is broken winged bird that cannot fly </b></font> <br> </body> </html>
登入後複製
輸出:
- 結論
- 用於以相同大小、顏色和麵格式顯示文字。字體標籤將透過使用 .. 顯示。標籤。
以上是HTML 中的字型標籤的詳細內容。更多資訊請關注PHP中文網其他相關文章!
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章
如何修復KB5055523無法在Windows 11中安裝?
3 週前
By DDD
如何修復KB5055518無法在Windows 10中安裝?
3 週前
By DDD
<🎜>:死鐵路 - 如何馴服狼
4 週前
By DDD
<🎜>:種植花園 - 完整的突變指南
2 週前
By DDD
R.E.P.O.的每個敵人和怪物的力量水平
4 週前
By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

本教程演示瞭如何使用PHP有效地處理XML文檔。 XML(可擴展的標記語言)是一種用於人類可讀性和機器解析的多功能文本標記語言。它通常用於數據存儲
