javascript Cufon:下划线文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3315701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cufon: Underline Text
提问by Haris
How can I underline a text replaced with Cufon?
如何在用 Cufon 替换的文本下划线?
回答by Chris McFarland
text-decorationis not supported by Cufon:
https://github.com/sorccu/cufon/wiki/known-bugs-and-issues
text-decorationCufon 不支持:https:
//github.com/sorccu/cufon/wiki/known-bugs-and-issues
Perhaps you could add a border-bottomproperty to the element using normal CSS?
也许您可以border-bottom使用普通 CSS 向元素添加属性?
回答by Alex
Cufon adds a class to the elements it creates that you can style (useful if your containing element has pads/margins). So for a link, just use this:
Cufon 为它创建的元素添加了一个类,您可以设置它的样式(如果您的包含元素具有填充/边距,则很有用)。所以对于链接,只需使用这个:
a .cufon {border-bottom: solid 1px #000000}
a:hover .cufon {border-bottom: none}
To keep your elements from shifting up/down, either add a border to the non hover state, or adjust the heights of both elements accordingly...
为了防止您的元素向上/向下移动,请为非悬停状态添加边框,或相应地调整两个元素的高度...
回答by Rick
Be aware though. Adding a border bottom to a cufon class is quite ugly.
不过要注意。向 cufon 类添加边框底部非常难看。
I'd be best to avoid underlines to these fonts in your design. It might look nice in Photoshop, but don't show this to you customers. It doesn't work out that well in HTML/CSS.
我最好避免在您的设计中为这些字体添加下划线。它在 Photoshop 中可能看起来不错,但不要向您的客户展示。它在 HTML/CSS 中效果不佳。

