Text-decoration: underline not applying with inline-block span elements

一世执手 提交于 2019-12-01 18:02:58

How about using border-bottom to underline the text?

a {
     text-decoration:none;
    border-bottom: 1px solid blue; /*Remove this if you want it only on hover*/
}
a:hover {
    text-decoration:none;
    border-bottom: 1px solid red;
    color:red;
}

Fiddle

By CSS specs, the underline does not affect inline blocks inside the element for which text-decoration: underline has been set.

You can make them underlined by explicitly setting that for them, for example by replacing the selector a:hover in your last CSS rule by the selector list a:hover, a:hover *.

This will not affect the ellipsis symbol, though. It is not part of any element content but inserted by a browser, so I don’t think you can underline it.

a little bit weird though...

add these css?

CSS

.details h2{
    border-bottom:1px solid #fff; /*use the same color as your .details background color*/
}
.details h2:hover {
    border-bottom:1px solid #f00;
}

See DEMO on jsfiddel...http://jsfiddle.net/c7p8w/14/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!