HTML 文字修飾
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>
輸出:
說明:如您所見,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>
輸出:
說明:如您所見,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>
輸出:
說明:如您所見,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>
輸出:
說明:如您所見,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 文字修飾的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

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

熱門文章

熱工具

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

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

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

Dreamweaver CS6
視覺化網頁開發工具

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

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