css去掉下劃線的方法:可以利用text-decoration屬性來實現,如【text-decoration: none;】,屬性值none表示沒有文字裝飾。
本文操作環境:windows10系統、css 3、thinkpad t480電腦。
可以使用text-decoration 屬性來取消文字下劃線,該屬性規定新增到文字的修飾,下劃線、上劃線、刪除線等。
基本語法:
/*關鍵值*/ text-decoration: none; /*沒有文字裝飾*/ text-decoration: underline red; /*紅色下劃線*/ text-decoration: underline wavy red; /*紅色波浪形下劃線*/ /*全域性值*/ text-decoration: inherit; text-decoration: initial; text-decoration: unset;
屬性值:
none 預設。定義標準的文字。
underline 定義文字下的一條線。
overline 定義文字上的一條線。
line-through 定義穿過文字下的一條線。
blink 定義閃爍的文字。
inherit 規定應該從父元素繼承 text-decoration 屬性的值。
(學習視訊分享:)
程式碼範例如下:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>TW511.COM(php.cn)</title> <style> h1.under { text-decoration: underline; } h1.over { text-decoration: overline; } p.line { text-decoration: line-through; } p.blink { text-decoration: blink; } a.none { text-decoration: none; } p.underover { text-decoration: underline overline; } </style> </head> <body> <h1 class="under">下劃線</h1> <p class="line">刪除線</p> <p class="blink">閃爍效果,但瀏覽器不會顯示</p> <h1 class="over">下劃線</h1> <p>這是一個 <a class="none" href="#">連結</a>,預設情況下連結是有下劃線的,這邊我們移除它。</p> <p class="underover">上劃線與下劃線</p> </body> </html>
相關推薦:
以上就是css怎麼去掉下劃線的詳細內容,更多請關注TW511.COM其它相關文章!