How to change the link color in a specific class f

2020-01-30 08:32发布

In my Page the following CSS is set:

a:link {
    color: #0094DE;
    text-decoration: none;


}
a:visited {
        text-decoration: none;
color: #0094DE;

}
a:hover {
text-decoration: underline;
color: #DD127B;

}

I want to Change the Link color inside a div which has a class assigned to it. I tried the following :

register:link{color:#FFFFFF;
        }

Where register is the name of the div in which i want to change the link color. How can i do that? Also how to change the color for hover link over the same div?

7条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-01-30 08:48

how about something like this ...

a.register:link{
    color:#FFFFFF;
}
查看更多
地球回转人心会变
3楼-- · 2020-01-30 08:48

I think you want to put a, in front of a:link (a, a:link) in your CSS file. The only way I could get rid of that awful default blue link color. I'm not sure if this was necessary for earlier version of the browsers we have, because it's supposed to work without a

查看更多
Bombasti
4楼-- · 2020-01-30 08:49

It can be something like this:

a.register:link { color:#FFF; text-decoration:none; font-weight:normal; }
a.register:visited { color: #FFF; text-decoration:none; font-weight:normal; }
a.register:hover { color: #FFF; text-decoration:underline; font-weight:normal; }
a.register:active { color: #FFF; text-decoration:none; font-weight:normal; }
查看更多
ら.Afraid
5楼-- · 2020-01-30 08:51
#register a:link
{
color:#fffff;
}
查看更多
相关推荐>>
6楼-- · 2020-01-30 08:55

If you want to add CSS on a:hover to not all the tag, but the some of the tag, best way to do that is by using class. Give the class to all the tags which you want to give style - see the example below.

<style>
a.change_hover_color:hover { 
    color: white !important;
}
</style>

<a class="change_hover_color">FACEBOOK</a>
<a class="change_hover_color">GOOGLE</a>
查看更多
别忘想泡老子
7楼-- · 2020-01-30 08:59

smaller-size version:

#register a:link {color: #fff}
查看更多
登录 后发表回答