gpt4 book ai didi

html - 更改跨度元素的高度

转载 作者:太空宇宙 更新时间:2023-11-04 16:00:05 25 4
gpt4 key购买 nike

我试图通过将所选文本放在 span 元素中然后为 span 提供彩色底部边框来实现彩色下划线,例如

border:bottom: 1px solid red;

这行得通,但是该行在单词下面太远了: enter image description here

这是整个 span 元素周围的边框: enter image description here

有没有人看到一种方法可以降低 span 元素的高度,使底部边框更靠近单词?

谢谢

最佳答案

行内元素没有高度,所以可以把display属性改成inline-block之类的,然后用line-height属性移动边界更近:

span {
border-bottom: 1px solid red;
display: inline-block;
line-height: 10px;
}
Does anyone see a way to <span>reduce</span> the height of the span element so the bottom border is closer to the word?

关于html - 更改跨度元素的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42287905/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com