如何在悬停时更改href的颜色

时间:2022-11-04 20:53:52

I have the following code in my jsp:

我在jsp中有以下代码:

<a href="#expProd" id="${model.product.actualT[status.index].Id}" class="highlight"><spring:message code="label.actual.expand" /></a> 
                                                                                </div>

Basically i have to change the color to orange when the mouse is over the label and blue as default color. I know how to do it using an id attribute as indicated in this post(HTML / CSS - Hover Link Color since my id is generated as shown below i can't use it:

基本上我必须在鼠标悬停在标签上时将颜色更改为橙​​色,将蓝色更改为默认颜色。我知道如何使用这篇文章中指出的id属性(HTML / CSS - 悬停链接颜色,因为我的id生成如下所示,我无法使用它:

id="${model.product.actualT[status.index].Id}" 

Any idea how to do it please? I tried using the class tag but it is not working.

知道怎么办吗?我尝试使用类标记,但它不起作用。

Thanks in advance

提前致谢

2 个解决方案

#1


0  

See this fiddle

看到这个小提琴

.highlight:hover{
color:red;
}

#2


1  

You can simply use additional class selector in css

您可以在css中使用其他类选择器

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

#1


0  

See this fiddle

看到这个小提琴

.highlight:hover{
color:red;
}

#2


1  

You can simply use additional class selector in css

您可以在css中使用其他类选择器

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