html - 如何在文本末尾显示下划线?
问题描述
我在最后显示的标题下方显示下划线,但在移动设备中我遇到了一个问题。我必须在标题文本的末尾显示下划线。截至目前,它显示在最后。
注意:我只需要显示下划线的 75px 宽度(我会根据需要增加)。每个部分都有不同的标题,所以我必须在 75px 上显示。
桌面
移动的
这是我的预期输出
.section-title h2 {
position: relative;
display: inline-block;
}
.section-title h2::before {
content: "";
border-bottom: 4px solid #E43D32;
position: absolute;
display: block;
width: 75px;
right: 0;
bottom: -8px;
}
.section-title h2 span{color:red;}
@media all and (max-width: 768px) {
.section-title h2 {
font-size: 40px;
}
}
<div class="section-title">
<h2><span>OTHER</span> SUPER HEADING</h2>
</div>
解决方案
推荐阅读
- sql - 按产品和月份划分的反转量
- javascript - 在 Leaflet.js 中,如何获取正确的 x/y 值以便为 tileLayer 处理它们?
- c - 如何在C中的最后一个非零数字之后计数零
- rust - 将字符串编码为复制安全值
- pandas - 如何对熊猫表中的值进行平均
- reactjs - 如何在react js中为usestate中的对象数组创建接口
- java - 如何使用原始 Java RSocket 路由即发即弃请求?
- python - 如何使 Tkinter 按钮执行 while 循环,直到按下另一个按钮
- sql - 如何在 ArcGIS Pro“按属性选择”工具中使用 MAX 和 Group BY SQL 表达式
- python - Python可执行控制台未显示