目錄
HTML 中的文字裝飾如何運作?
HTML 文字修飾範例
範例 #1 – 無
範例 #2 – 底線
範例 #3 – 上劃線
範例 #4 – 直通
範例#5
結論
首頁 web前端 html教學 HTML 文字修飾

HTML 文字修飾

Sep 04, 2024 pm 04:40 PM
html html5 HTML Tutorial HTML Properties HTML tags

HTML 中的文字裝飾,用於以不同方式裝飾文字。 text-decoration 是用於文字裝飾的屬性。 text-decoration 屬性採用底線、上劃線、穿行線、底線劃線值以不同的方式裝飾文字。

即時範例:文字裝飾上劃線、底線、穿線值用於產生驗證碼,同時確認登入使用者是人類還是機器人。因為如果機器人無法完美辨識文字頂部的線條。

類型:

  • 文字裝飾:無;
  • 文字修飾:上劃線;
  • 文字修飾:換行;
  • 文字裝飾:底線;

HTML 中的文字裝飾如何運作?

文字裝飾屬性基於無、上劃線、穿線和底線

1。無

文法:

text-decoration: none;
登入後複製

說明:它不會為文字帶來任何裝飾。就像普通文字一樣。

2。上劃線

文法:

text-decoration: overline;
登入後複製

說明:它將在文字頂部給出一條大小為 1px 的線。

3。直通

文法:

text-decoration: line-through;
登入後複製

說明:它將給出從文本中間開始的1px大小的線條。

4。底線

文法:

text-decoration: underline;
登入後複製

說明:它會在文字底部給出一條 1px 大小的線。

5。眨眼

文法:

text-decoration: blink;
登入後複製

說明:它會讓文字以不同顏色閃爍,透明度從0%到100%。

注意: 最新瀏覽器的閃爍功能已被棄用。現在根本不用了。

Text-decoration屬性還可以用顏色製作預設樣式以外的上劃線、穿線、底線等不同樣式的點線、波浪線、實線、凹槽等。您可以看到以下語法。

文法:

text-decoration: underline dotted red;
登入後複製

HTML 文字修飾範例

以下是 HTML 文字裝飾的範例:

範例 #1 – 無

代碼:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.none {
text-decoration: none;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:none</h1>
<p class="none">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in the development of back end features in Spring MVC with Hibernate. Developed importing models and logic in the Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登入後複製

輸出:

HTML 文字修飾

說明:如您所見,text-decoration: none 不能為段落文字提供任何線條裝飾。

範例 #2 – 底線

代碼:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.underline {
text-decoration: underline;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:underline</h1>
<p class="underline">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登入後複製

輸出:

HTML 文字修飾

說明:如您所見,text-decoration: underline 給了文字下方的線條。

範例 #3 – 上劃線

文字修飾:上劃線範例:

代碼:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.overline{
text-decoration: overline;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:overline</h1>
<p class="overline">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登入後複製

輸出:

HTML 文字修飾

說明:如您所見,text-decoration: overline 在文字上方給出線條。

範例 #4 – 直通

文字裝飾:穿線範例:

代碼:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.through {
text-decoration: line-through;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:line-through</h1>
<p class="through">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登入後複製

輸出:

HTML 文字修飾

說明:如您所見,text-decoration: line-through 從文字中間給出線條。

範例#5

有實線、雙線、波浪線、底線、底線、上劃線的文字裝飾範例:

代碼:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.p1 {
text-decoration:solid overline brown;
font-size:18px;
}
.p2 {
text-decoration:double line-through blue;
font-size:18px;
}
.p3 {
text-decoration:wavy underline red;
font-size:18px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:solid overline brown</h1>
<p class="p1">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
<h1>Demo for text-decoration:double line-through blue</h1>
<p class="p2">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
<h1>Demo for text-decoration:wavy underline red</h1>
<p class="p3">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登入後複製

輸出:

HTML 文字修飾

說明:如您所見,第一段有實線上劃線,第二段有雙下劃線,第三段有波浪下劃線文字裝飾樣式。

結論

文字裝飾可以透過上劃線、底線、穿線屬性值以及任何顏色的不同線條樣式進行樣式化。

以上是HTML 文字修飾的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

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

AI Clothes Remover

AI Clothes Remover

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

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

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

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

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

熱門話題

Java教學
1655
14
CakePHP 教程
1414
52
Laravel 教程
1307
25
PHP教程
1254
29
C# 教程
1228
24
HTML 中的表格邊框 HTML 中的表格邊框 Sep 04, 2024 pm 04:49 PM

HTML 表格邊框指南。在這裡,我們以 HTML 中的表格邊框為例,討論定義表格邊框的多種方法。

HTML 中的巢狀表 HTML 中的巢狀表 Sep 04, 2024 pm 04:49 PM

這是 HTML 中巢狀表的指南。這裡我們討論如何在表中建立表格以及對應的範例。

HTML 左邊距 HTML 左邊距 Sep 04, 2024 pm 04:48 PM

HTML 左邊距指南。在這裡,我們討論 HTML margin-left 的簡要概述及其範例及其程式碼實作。

HTML 表格佈局 HTML 表格佈局 Sep 04, 2024 pm 04:54 PM

HTML 表格佈局指南。在這裡,我們詳細討論 HTML 表格佈局的值以及範例和輸出。

HTML 輸入佔位符 HTML 輸入佔位符 Sep 04, 2024 pm 04:54 PM

HTML 輸入佔位符指南。在這裡,我們討論 HTML 輸入佔位符的範例以及程式碼和輸出。

HTML 有序列表 HTML 有序列表 Sep 04, 2024 pm 04:43 PM

HTML 有序列表指南。在這裡我們也分別討論了 HTML 有序列表和類型的介紹以及它們的範例

HTML onclick 按鈕 HTML onclick 按鈕 Sep 04, 2024 pm 04:49 PM

HTML onclick 按鈕指南。這裡我們分別討論它們的介紹、工作原理、範例以及各個事件中的onclick事件。

您如何在PHP中解析和處理HTML/XML? 您如何在PHP中解析和處理HTML/XML? Feb 07, 2025 am 11:57 AM

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

See all articles