html - 我怎样才能使这条线在后面的部分居中?- CSS
问题描述
我希望将这条线放在标题下方的中间,但是当我尝试 text-align 时它不起作用。
body {
background-color: #000;
color: #FFF;
font-family: 'Noto Sans KR', sans-serif;
}
.title{
position: relative;
top: 70px;
line-height: 15px;
letter-spacing: 1em;
font-size: 30px;
display: block;
text-align: center;
}
.title::after {
display: block;
width: 300px;
height: 20px;
border-bottom: 3px solid #FFF;
content: "";
color: #FFF;
text-align: center;
}
很抱歉,因为现在还不是我点击推荐的时候。感谢您的所有回答。
解决方案
这会吗?
body {
background-color: #000;
}
section {
position:relative;
}
.title{
color: #fff;
line-height: 15px;
letter-spacing: 1em;
font-size: 30px;
display: block;
text-align: center;
border-bottom-width: 50%;
}
.title::after {
position:absolute;
display: block;
width: 300px;
height: 20px;
border-bottom: 3px solid #FFF;
content: "";
color: #FFF;
text-align: center;
left: 25%;
}
<body>
<section>
<div class="title">What I Play</title>
</section>
</body>
推荐阅读
- python - python中的fiona导入问题
- php - 为什么我在路由时必须通过 index.php
- regex - 在vim中查找和替换花括号之间的所有内容
- python-3.x - 尝试使用 kaggle API 时出现“-bash: command not found”
- c# - 如何从 ContentDisposition 获取扩展
- javascript - 将函数限制为仅使用“new”运算符调用
- node.js - 共享会话 Socket.io Express
- vba - 宏按钮在 Excel 中添加行(带有下面行中的公式),同时保持标题
- arrays - 在已知片段中拆分数组
- c++ - UWP:在 TreeNode 中将文本设置为粗体