使用css更改下划线颜色在Chrome中不起作用? [英] Changing underline color with css doesn't work in chrome?

查看:434
本文介绍了使用css更改下划线颜色在Chrome中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用跨度的悬停事件期间更改下划线颜色,它适用于IE9和Firefox 13.01,但它不能在Chrome(它应该在黄金下划线)。

I am trying to change the underline color during a hover event using spans and it works in IE9 and Firefox 13.01 but it doesn't work in Chrome (it should underline in gold).

#menu li:hover span.underline {
text-decoration:underline;
color:#FAA301; }

< ul id =menu>
< li style =z-index:7;>< span class =underline>< a href =#> link1< / a>< / span> ; / li>
< / ul>

这里是js.fiddle: http://jsfiddle.net/wuUpL/7/

Here is js.fiddle: http://jsfiddle.net/wuUpL/7/ .

我最初从这篇文章获得了想法 http://stackoverflow.com / a / 1175402/1490248 ,但是一个不能在chrome中工作。

I originally got the idea from this post http://stackoverflow.com/a/1175402/1490248 but that one doesn't work in chrome either.

注意:我不想使用边框来修复这个问题,我已经使用边框作为边界

Note: I don't want to use borders to fix this, I am already using borders as a border

任何人都可以帮助我在这里?是否有某种Chrome黑客/异常可以用来解决这个问题?

Can anyone help me out here? Is there some sort of chrome hack/exception I could use to fix this?

推荐答案

我知道你说你不想在这里使用边框,但是你发现两个浏览器之间的工作方式不一样。

I know you said you didn't want to use borders here, but you have found something that doesn't work the same between the two browsers.

您可以通过添加 > inner span 并使用边框。

You can get this to work on Chrome by adding an inner span and using a border on it.

http://jsfiddle.net/wuUpL/10/

对不起,如果它不是你的想法,但Gecko和WebKit不同意这里的东西!

Sorry if it is not what you had in mind, but Gecko and WebKit are not agreeing on something here!

这篇关于使用css更改下划线颜色在Chrome中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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