CSS 怎样用css设置超链接字体的不同颜色

html-css014

CSS 怎样用css设置超链接字体的不同颜色,第1张

怎样用css设置超链接字体的不同颜色

2006-6-7

10:39

yywzya:link

{

text-decoration:

none

color:

#31687E}a:visited

{

color:

#31687E

text-decoration:

none}a:hover

{

color:

#FF0000

text-decoration:

none}a:active

{

color:

#FF0000

text-decoration:

none}a.v1:link

{

text-decoration:

underline

color:

#31687E}a.v1:visited

{

color:

#31687E

text-decoration:

underline}a.v1:hover

{

color:

#333333

text-decoration:

underline}a.v1:active

{

color:

#FF0000

text-decoration:

none}上面四个为默认的超级链接的样式,下面四个为不同颜色的链接样式,不过在链接的时候要调用一下v1的名字如这种格式<a

href="index.asp"

class="v1">首页</a>

例如有一个超链<a

href="#"

id="aa"

class="bb"></a>

在样式表中设置:

#aa{

<!--

或者设置为

.bb

-->

font-family:微软雅黑

<!--

字体

-->

font-size:14px

<!--

字体大小

-->

color:gray

<!--

字体颜色

-->

text-decoration:none

<!--

字体下划线等;underline下划线,overline

上划线,line-through线在中间

-->

cursor:pointer

<!--

鼠标在字上时显示小手

-->

}

如果想设置鼠标悬停在字上时的效果:

#aa:HOVER{

<!--

或者设置为

.bb

-->

font-family:xxx

<!--

字体

-->

font-size:xxx

<!--

字体大小

-->

color:

xxx

<!--

字体颜色

-->

text-decoration:xxx

<!--

只要有的功能想要的都可以加上

-->

}

html语言不用修改

还是直接给文字加链接

你可以

在css样式中写

a{

color:#333

/*无链接时颜色*/

}

a:hover{

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

a:active{

color:#30F

/*鼠标点击链接时颜色*/}

比如:css中写