HTML / CSS - 悬停链接颜色 [英] HTML / CSS - Hover Link Color

查看:191
本文介绍了HTML / CSS - 悬停链接颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码写在我的CSS;这使我的网站上的所有链接都是白色的,当他们徘徊时,它们变成灰色。

I have this code written in my CSS; which makes all links on my site white, and when they're hovered on, they turn gray.

a:link {color: #FFFFFF}
a:active {color: #383838}
a:visited {color: #FFFFFF}
a:hover {color: #383838}

这是我的网站的一部分,其链接是白色的,当悬停时变成灰色。我在网站上有四个不同的链接,由| 。我试图使每个链接保持白色,但改变为不同的HTML颜色,每当他们徘徊在...匹配我们的标志。 (具有我的链接的代码的HTML部分附于下面)。

Here's the portion of my site which has links that are white and turn gray when hovered on. I have four different links on the site separated by a "|" . I am trying to make each link STAY white, but change to a different HTML color whenever they're hovered on….to match our logo. (HTML section of the code that has my links are attached below).

第1页 | Page 2 | |

我想如果有人能帮助我一个非常简单,简单的方式来创建每个链接,第1页,第2页,第3页和第4页,每当它们悬停时,它们会改变不同的HTML颜色。基本上,一个规则或某事,说,名为第1页的链接需要着色#C7C025当hover on ...和名为第2页的链接需要着色#950285当徘徊等等...

I would love if someone could help me figure out a very easy, simple way to make each link, Page 1, Page 2, Page 3 and Page 4, each change different HTML colors when they're hovered on. Basically, a rule or something that says the link named Page 1 needs to be colored #C7C025 when hovered on…and the link named Page 2 needs to be colored #950285 when hovered on and so forth…

非常感谢!

推荐答案

为您的链接指定ID:

<a id="page1" href="http://www.my-website09090909.com/page1">Page 1</a>
<a id="page2" href="http://www.my-website09090909.com/page1">Page 2</a>
<!-- .... -->

然后使用此css:

#page1:hover { color: red; }
#page2:hover { color: blue; }
/* ... */

这篇关于HTML / CSS - 悬停链接颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆