【问题标题】:How to change color to a link in div?如何将颜色更改为 div 中的链接?
【发布时间】:2015-10-17 13:54:19
【问题描述】:

我已经创建(从在线工具复制和编辑)一个带有文本 here on the botton right corner 的小框

我还想更改框中文本的颜色。但是有命令 a:link, a:visited。

我怎样才能绕过这些命令并为文本赋予我想要的颜色,同时保持链接?

谢谢

【问题讨论】:

  • 您可以通过对 .button 类执行此操作来避免 :link 和 :visited:.button { color: #28a26b !important; } 或者您也可以覆盖 :link 和 :visited 选择器。
  • 用你想要的颜色改变 :link 和 :visited 选择器不是一个好主意吗?
  • 我同意 Yura Yakym :)

标签: css


【解决方案1】:

伪选择器作为 a:link 和 a:hover(以及更多)会改变浏览器的默认行为。你可以省略它们,但我很确定你不想这样做。

a:link 设置锚的样式,因此它不是默认的蓝色下划线。

a:hover 将鼠标移到链接上时设置锚点的样式。

使用您选择的搜索引擎了解更多信息,尝试“css 伪选择器”

阅读代码,颜色设置都在那里:

.button {
    display: inline-block;  
    text-align: center;
    vertical-align: middle;
    padding: 12px 24px; 
    border: 1px solid #28A26B;
    border-radius: 8px;
    background: transparent 
            linear-gradient(to bottom, #FFF, #FFF)
            repeat scroll 0% 0%; 
            // this is what you're probably 
            // looking for - the color of the button body.
            // It's set to transparent.
    font: bold 20px arial;
    color: #28A26B;  // Color of the content
    text-decoration: none;
}
.button:hover, .button:focus {
    // these pseudo classes just make the js events onmouseover
    // and onclick obsolete...
    color: #28A26B; 
    text-decoration: none;

}

将背景设置为您选择的颜色,删除渐变部分,您就完成了。不要盲目复制。

【讨论】:

    【解决方案2】:

    styles.css 文件第 77 行的规则后放这个:

    #call-to-action a:link, #call-to-action a:visited {
        color:yellow ;
    }
    

    【讨论】:

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