-->

强调不同颜色的HTML锚(Underlining an html anchor with diffe

2019-09-17 02:01发布

是否有可能强调,对于小于其文本的颜色以外的其他颜色的锚标记? 任何示例将不胜感激。

编辑:是否可以指定颜色为十六进制,如#8f867c?

Answer 1:

您不能单独指定下划线颜色,但你可以用一个小技巧:

a {
    color: red;
    text-decoration: none;
    border-bottom: 1px solid green;
}

请注意,边框不会出现正是下划线将纷纷亮相,对不起。



Answer 2:

假设你想要的“边界”,只显示在用户移到它自己的鼠标,你应该做这样的事情:

a {
  text-decoration: none;
}

a:hover {
  border-bottom: 1px solid blue;
  text-decoration: none;
}


Answer 3:

这是更好,你可以给边境它。 像这样写:

a{
text-decoration: none;
color:green;
border-bottom:1px solid red;
}

勾选此http://jsfiddle.net/dgc4q/



Answer 4:

是否有可能强调,对于小于其文本的颜色以外的其他颜色的锚标记? 任何示例将不胜感激。

我觉得奇怪,但我刚刚得知: 是的,这就是 ,如果你包内的跨度。

HTML:

<a href='#'><span>Howdy Partner</span></a>

CSS(SASS)

html
  font-size: 6em

a
  color: red

span  
  color: green 



文章来源: Underlining an html anchor with different color
标签: html css anchor