javascript - 如何在 CSS 中更改文本下划线的线宽
问题描述
我希望输出如下btw 目前我正在使用波纹管 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: "";
}
推荐阅读
- laravel - 如何在 Laravel/Lighthouse/Passport/Nuxt 应用程序上使用 Dusk 测试登录?
- git - 如何可靠地确定远程存储库中的最后提交日期?
- javascript - 无法在 vue 图像 src 绑定中使用波浪号 (~)
- android - 添加 ClickListener 时出现 NullPointerException
- assembly - 如何在 ARM Assembly 中将大写字母转换为小写字母?
- php - 使用 php 将联系人保存到手机不直接打开保存联系人屏幕(iPhone 用户)
- swift - 以编程方式滚动到 WKWebView 的底部不起作用
- javascript - 在网页中创建文本,如下图所示
- c# - 未触发打印作业
- javascript - 要求在 React Native 中选择音频文件?