【问题标题】:Different color for underline then font [duplicate]下划线和字体的不同颜色[重复]
【发布时间】:2016-12-01 14:14:03
【问题描述】:

有没有办法为文本下划线和文本本身制作不同的颜色?

在大多数浏览器上,text-decoration-color 似乎是 not available。那么还有其他方法吗?

【问题讨论】:

  • 使用边框?使用伪元素?很多方法。但是你不能直接访问下划线。

标签: css text-decorations


【解决方案1】:

使用border-bottomtext-decoration: none。它似乎与带下划线的链接相同。

看看下面的sn-p:

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

a:hover {
  color: blue;
  border-color: red;
}
<a href="#">This is a underlined link</a>

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 2010-09-16
    • 1970-01-01
    • 2012-09-30
    • 1970-01-01
    • 2016-10-22
    • 2012-03-19
    相关资源
    最近更新 更多