【发布时间】:2019-08-22 13:00:36
【问题描述】:
在链接上使用 text-decoration 时,不包含子元素 (span),因此下划线不会延伸:
a {
font-size: 36px;
text-decoration: underline dotted rgb(221, 221, 221);
color: #000;
}
a:hover {
text-decoration: none;
color: #000;
}
.badge-dark {
font-size: 9px;
margin-left: 2px;
position: relative;
text-align: center;
top: -5px;
}
<a href="#">
My title is here
<span class="badge badge-dark">Special</span>
</a>
span 是否有可能被包括在内,或者text-decoration 是否可以在设计上忽略跨度?
【问题讨论】:
-
badge badge-darkclasses 正在删除text-decoration:underline。尝试删除类并检查span上的underline -
@j08691 查看更新
-
@M4FI4S 查看更新 - 因为它继承自 Boostrap,认为它可能会有所帮助..
-
文本装饰被添加到跨度 - 如果你放大你可以看到它。下划线添加在单词下方(并调整为该文本的大小),而不是元素下方 - 如果您想在整个锚点下方添加一条线,请改用边框底部
-
@Pete 好点,但不会将边框底部放置在元素下方,因此该行不会“切割”“y”、“g”等字母。?
标签: css bootstrap-4 text-decorations