当主DIV悬停时,更改链接颜色
我的问题是,当我将鼠标悬停在 div 上时,它不会将链接颜色更改为我想要的颜色。它只是保留其定义的默认黑色。但是当我直接将鼠标悬停在 div 中的链接上时,链接会改变颜色。
如何才能使当我将鼠标悬停在主 div 上时,它会更改 div 中链接的颜色?
链接到我的网站:https://www.temporary-url.com/CF16F6 尾巴:更多新闻
我有如下代码:
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3):hover a
{
color: #CB701A;
}
/* unvisited link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:link
{
color: #333333;
}
/* visited link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:visited
{
color: #CB701A;
}
/* selected link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:active
{
color: #333333;
}
/* mouse over link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:hover
{
color: #CB701A;
}
my issue is that, when I hover over my div, it doesn't change the links color to what I want it to be. It just stays its default black color as it is defined. But when I hover on link directly in div then link change color.
How can I make it so that when I hover over main div, it changes the color of the link inside in div?
Link to my website: https://www.temporary-url.com/CF16F6
tail: more news
I have code like below:
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3):hover a
{
color: #CB701A;
}
/* unvisited link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:link
{
color: #333333;
}
/* visited link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:visited
{
color: #CB701A;
}
/* selected link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:active
{
color: #333333;
}
/* mouse over link */
div.zsm_block_news > div.zsm_block_content > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > a:hover
{
color: #CB701A;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要将
:hover
属性放在 div 上而不是a
标记上you want to place the
:hover
attribute on the div rather than thea
tag