更改< a>链接下划线颜色 [英] Changing <a> link underline color

查看:111
本文介绍了更改< a>链接下划线颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何窍门来解决这个问题。

I wonder if there is any trick to solve this problem.

我有我的链接下面的文字,并想改变下划线的颜色。

I have my link as below text and want to change the underline color.

此链接包含许多行,需要将下划线的颜色更改为比现有的更浅

使用border bottom不是解决这个问题的方法,因为多行。

Using border bottom is not the way to solve this because multiple lines.

有什么办法解决这个问题吗?

are there any trick to solve this?

编辑

EDIT

@Paolo Bergantino: hack with IE6,7?

@Paolo Bergantino: It works with IE8 , is it possible to hack with IE6,7?

推荐答案

如果你的意思是一个不同的下划线颜色,我唯一能想到的是在链接周围添加一个跨度:

If what you mean is a different underline color than what the text is, the only thing I can think of is to add a span around the link:

<span class='underline'>
    <a href="#">this just<br>a test<br>of underline color</a>
</span>

然后CSS:

span.underline { 
    color: red; 
    text-decoration: underline; 
} 
span.underline a { 
    color: blue; 
    text-decoration: none; 
} 

并且

And you get what you want.

EDIT

测试这个更进一步,它不工作在我的IE。如果你添加border-bottom,但是,令人惊讶的是,在所有浏览器中工作,除了IE没有放在最后一个边框。我会尝试深入一点,看看是否有一个跨浏览器的方法来做这个...

Testing this a little further, it is not working for me on IE. If you add border-bottom, however, it surprisingly does work in all browsers, except that IE does not put a border under the last one. I will try to dig a little deeper to see if there's a cross-browser way to do this...

这篇关于更改&lt; a&gt;链接下划线颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆