【问题标题】:Unable to change link color code in header无法更改标题中的链接颜色代码
【发布时间】:2019-02-15 03:48:51
【问题描述】:

我一直试图将标题中的链接更改为#000000,但由于某种原因它似乎没有改变颜色。我只想更改标题中的链接,而不是其余链接。下面是例子:

HTML:

<a class="submit-a-request" href="/hc/en-us/requests/new">Submit a request</a>

CSS:

a {
 color: #022550;
 font-family: 'Nunito Sans', sans-serif;
 text-decoration: none;
}

a:hover {
 text-decoration: underline;
}

这是我尝试的:

.submit-a-request a:link {
color: #000000;
}

还有这个:

a.submit-a-request {
color: #000000;
}

有人可以请教吗?谢谢。

【问题讨论】:

标签: html css header


【解决方案1】:

看起来您没有使用 CSS 定位正确的元素。试试这个:

a.submit-a-request {
   color: #000000;
}

/* Next line is optional - enter your own hex color for hover */
a.submit-a-request:hover { 
   color: #000000; 
}

【讨论】:

  • 这会使悬停时的颜色相同...您也需要更改颜色的十六进制代码。
  • 更新了关于更改悬停颜色的说明。
【解决方案2】:

a {
 color: green;
 font-family: 'Nunito Sans', sans-serif;
 text-decoration: none;
  
}

a:hover {
 text-decoration: underline;
 color:purple;
}

a:active{
color:orange;
}
&lt;a class="submit-a-request" href="#"&gt;Submit a request&lt;/a&gt;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-06
    • 1970-01-01
    • 2012-10-14
    • 2012-11-24
    • 1970-01-01
    • 2019-02-02
    • 1970-01-01
    相关资源
    最近更新 更多