在css中,可以利用“text-decoration”和color屬性來去除a標(biāo)簽的默認(rèn)樣式,只需要給a標(biāo)簽元素添加“a{text-decoration:none;color:#000;}”樣式即可。
本教程操作環(huán)境:windows7系統(tǒng)、CSS3&&HTML5版、Dell G3電腦。
css怎樣去除a標(biāo)簽的默認(rèn)樣式
在css中,我們可以通過text-decoration屬性,text-decoration 屬性規(guī)定添加到文本的修飾,可以用來去除a標(biāo)簽的下劃線。
還有color屬性,可以用來設(shè)置a標(biāo)簽的字體顏色。
下面我們通過示例來看一下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <style type="text/css"> a{ text-decoration: none; /* 去除默認(rèn)的下劃線 */ color: #000; /* 去除默認(rèn)的顏色和點(diǎn)擊后變化的顏色 */ } </style> <body> <a href="https://www.php.cn/" target="_blank">這是一個(gè)a標(biāo)簽</a> </body> </html>
輸出結(jié)果:
一個(gè)a標(biāo)簽的默認(rèn)樣式為:
如此我們便通過text-decoration屬性和color屬性去除了a標(biāo)簽的默認(rèn)樣式。
(學(xué)習(xí)視頻分享:css視頻教程)