css怎么让文字设置超链接后文字颜色不变?

html-css017

css怎么让文字设置超链接后文字颜色不变?,第1张

html语言不用修改 还是直接给文字加链接

你可以 在css样式中写

a{ color:#333/*无链接时颜色*/ }

a:hover{ color:#F00/*鼠标经过链接时颜色*/}

a:active{ color:#30F/*鼠标点击链接时颜色*/}

比如:css中写

a{ color:#333text-decoration:none}

a:hover{ color:#F00text-decoration:underline}

a:active{ color:#30F}

出来的效果就是 鼠标未经过时 黑色 滑过时 红色 点击时蓝色

加入css,就可以设置点击后不变色。可以参照下面的进行修改。

a:link

{color:

#FF0000}

/*

未访问的链接

*/

a:visited

{color:

#00FF00}

/*

已访问的链接

*/

a:hover

{color:

#FF00FF}

/*

当有鼠标悬停在链接上

*/

a:active

{color:

#0000FF}

/*

被选择的链接

*/

注意顺序

一般用标签做class的写最前面

<!DocType html>

<html>

<head>

<meta charset="utf-8">

<style>

a:link{ text-decoration: none}

.b {color: red}

.c {color: blue}

.d {color: green}

</style>

</head>

<div class = "showUser" >

<div class = "userList">

<p><a href="./index.php?id={uid}">{userName}</a><p>

<p><a class="b" href="./index.php?id={uid}">{userName}</a><p>

<p><a class="c" href="./index.php?id={uid}">{userName}</a><p>

<p><a class="d" href="./index.php?id={uid}">{userName}</a><p>

</div>

</div>

</body>

</html>