简体   繁体   English

在悬停时更改div中链接的颜色

[英]changing the color of links in a div on hover

I have a div that has a couple links in it and I was wondering if there was a way to change the global color of links when you hover over the div? 我的div中有几个链接,我想知道当您将鼠标悬停在div上时是否可以更改链接的全局颜色? Not that the color of the link changes when you hover over the link, but that all the links change color from the global link color when you hover over the div. 将鼠标悬停在链接上时,并不是链接的颜色会发生变化,而是将鼠标悬停在div上时,所有链接的颜色都会与全局链接的颜色发生变化。

Any help is greatly appreciated! 任何帮助是极大的赞赏!

Thanks! 谢谢!

The proper CSS would be something like this 正确的CSS应该是这样的

#divId:hover a:link,
#divId:hover a:visited,
#divId:hover a:active{color:#f00}

or 要么

.divClass:hover a:link,
.divClass:hover a:visited,
.divClass:hover a:active{color:#f00}
div:hover a {
   color: green;
}

should do the trick. 应该可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM