gpt4 book ai didi

javascript - 如何在CSS中更改文本下划线的线宽

转载 作者:行者123 更新时间:2023-12-02 21:10:44 24 4
gpt4 key购买 nike

我想要输出如下I want to like this顺便说一句,目前我正在使用下面的 CSS 来执行此操作

.text-underline {
border-bottom: 4px solid #f8f8f8;
padding: 0 0 2px;
}

但它适用于整个文本,我想减少该行的宽度

最佳答案

使用伪元素非常简单:

.text-underline:after {
display: block;
height: 0;
width: 5%; /* any width of your choice with any units e.g. px, em... */
border-bottom: 4px solid #ff0000;
content: "";
}

关于javascript - 如何在CSS中更改文本下划线的线宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61108172/

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