html - 行和文本之间的更多空间
问题描述
我正在尝试做这样的事情:
--------------------- WORK ------------------
---------------------
这是我的代码
h2 {
width:100%;
text-align:center;
border-bottom: 1px solid #000;
line-height:0.1em;
margin:10px 0 20px;
}
h2 span {
background:#fff;
padding:0 10px;
}
<h2><span>THIS IS A TEST</span></h2>
我尝试了很多更改,但不能。请让我知道该怎么做?
解决方案
HTML 代码:
<div class='white-line'></div>
<div class='line-title text-center' >
<span class='bg-black'>THIS IS A TEST</span>
</div>
CSS 代码:
.white-line{ height: 0; border-top: 1px;}
.bg-black{ background-color: #000000; }
推荐阅读
- r - 导入多个 Excel 工作簿,每个工作簿都包含 R 中的多个工作表
- symfony4 - 使用 VichUploaderBundle 通过 API 上传文件
- terraform - terraform aws-provider 每次尝试“1 添加,1 更改,1 销毁”
- c++ - std::to_chars 在 MacOS / clang 上编译但不链接
- python-3.x - Raspberry Pi 3 B+ (Buster) 无法控制 Dynamixel AX-12A 与 Raspberry Pi 3 B+ (Buster) 与半双工通信
- r - R中Excel的BETADIST()等价函数
- python - SqlAlchemy 使用 Join 查询两个类
- python - 使用 waitress 作为 Flask 的生产服务器
- python - 如何使用python将行插入csv文件
- python - f2py 链接 quadmath 库?将 ctypes 用于 fortran 包装器?