简体   繁体   English

改变IE中的下划线颜色

[英]Changing underline color in IE

I have text editor which user can play around. 我有文本编辑器,用户可以玩。 In that I have an IE underline color issue. 在那我有一个IE下划线颜色问题。 Below code 下面的代码

test <font color="#4ab948"><u>paragraph</u></font>

will applied color for text and underline. 将为文本和下划线应用颜色。 If user choose underline first then color, the code generated as below which will not apply color for underline :( 如果用户首先选择下划线然后颜色,下面生成的代码将不会应用下划线颜色:(

test <u><font color="#4ab948">paragraph</font></u>

Any luck ? 运气好的话 ?

font has been deprecated for a while now. font已被弃用了一段时间了。 Instead you should use span with the style attributes applied to the span . 相反,您应该使用带有应用于span的样式属性的span For example: 例如:

 <span style='color:#4ab948;text-decoration:underline;'>paragraph</span> 

If you want absolute control of the text-decoration property on the u element...override it with a pseudo-element. 如果你想要对u元素的text-decoration属性进行绝对控制...用伪元素覆盖它。

 u { text-decoration: none; position: relative; color: red; } u:after { content: ''; position: absolute; top: 100%; left: 0; width: 100%; height: 1px; background: green; margin-top: -2px; } 
 <u>paragraph</u> 

You can come up with two approaches 你可以提出两种方法

Using border-bottom as 使用border-bottom作为

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

OR 要么

using a-span Approach as 使用a-span方法作为

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM