I'm using the font Cardiff in a project and trying to apply the style text-decoration:underline
to it.
This works fine in Chrome (Version 35.0.1916.114) but Firefox (Version. 29.0.1) the underline is crossing through the text instead of appearing under it. I believe it's something to do with the Cardiff font because when I try a 'Web Safe' font the underline is displayed correctly.
This is how the Cardiff font is being displayed
If I then change the font to Helvetica, this is how it's displayed
I've tried a few things already:
- Wrapping the font in a
span
tag, then styling this as a block and giving it a height - I've also tried a solution provided in another question
Updated...
Using fixes provided by @touko I've put together a solution that isn't really what I wanted to settle for but it works.
I've used a border for Firefox and regular text-decoration
for other browsers.
h2 {
text-decoration: underline;
}
Firefox specific CSS styling as explained on this solution...
@-moz-document url-prefix() {
h2 {
text-decoration: none;
display: inline;
border-bottom: 1px solid #4c2f04;
padding-bottom: 6px;
}
}
I hope someone finds a better solution than this though because it's more of a bodge job if anything.