【问题标题】:changing the color of links in a div on hover在悬停时更改 div 中链接的颜色
【发布时间】:2012-05-10 01:02:46
【问题描述】:

我有一个 div,其中有几个链接,我想知道当您将鼠标悬停在 div 上时,是否有办法更改链接的全局颜色?并不是当您将鼠标悬停在链接上时链接的颜色会发生变化,而是当您将鼠标悬停在 div 上时,所有链接的颜色都会从全局链接颜色发生变化。

非常感谢任何帮助!

谢谢!

【问题讨论】:

    标签: html href


    【解决方案1】:

    正确的 CSS 应该是这样的

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

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

    【讨论】:

      【解决方案2】:
      div:hover a {
         color: green;
      }
      

      应该可以解决问题。

      【讨论】:

        猜你喜欢
        • 2016-05-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-05
        相关资源
        最近更新 更多