I am currently using the Cardiff font in a project and attempting to apply the style text-decoration:underline
to it.
While this works perfectly in Chrome (Version 35.0.1916.114), in Firefox (Version. 29.0.1) the underline appears to be crossing through the text rather than appearing under it. I suspect that this issue is related to the Cardiff font because when I switch to a 'Web Safe' font, the underline displays correctly.
This is how the Cardiff font is being presented:
When I change the font to Helvetica, this is how it looks:
I have already attempted a few solutions:
- Wrapping the font in a
span
tag, styling it as a block, and assigning it a height - Testing out a solution mentioned in another thread
Update...
After implementing fixes suggested by @touko, I've come up with a workaround that isn't ideal but gets the job done.
I decided to use a border for Firefox and stick with regular text-decoration
for other browsers.
h2 {
text-decoration: underline;
}
For applying specific CSS styling for Firefox only, following guidelines from this source...
@-moz-document url-prefix() {
h2 {
text-decoration: none;
display: inline;
border-bottom: 1px solid #4c2f04;
padding-bottom: 6px;
}
}
I hope someone discovers a more elegant solution than this because my current approach feels like a temporary fix at best.