css - 如何将页脚中的文本略微移动
问题描述
我有一个页脚,我希望其中的所有文本稍微向左移动,这样它看起来更居中。如果我添加边距或更改填充,它们将更改所有 's,我不想这样做。我只想将文本(链接)作为一个整体移动一点。
.footer {
background: #3E3D3D;
padding: 0.625rem 0.75rem;
}
.footer_list {
/*ul*/
list-style: none;
text-align: center;
margin: 0;
}
.footer_lists {
display: inline-block;
padding: 0px 1rem;
}
.footer_lists a {
color: white;
text-decoration: none;
font-family: 'Oswald', sans-serif;
}
.footer_lists a:hover,
.footer_lists a:active {
color: silver;
}
<footer class="footer">
<ul class="footer_list">
<li class="footer_lists"><a href="about.html">About Us</a></li>
<li class="footer_lists"><a href="Contact.html">Contact</a></li>
<li class="footer_lists"><a href="privacy.html">Privacy Policy</a></li>
</ul>
</footer>
解决方案
在<ul>
标签上,默认情况下,padding-inline-start
CSS 属性值设置为40px
. 所以你需要重新设置这个值。
.footer {
background: #3E3D3D;
padding: 0.625rem 0.75rem;
}
.footer_list {
/*ul*/
list-style: none;
text-align: center;
margin: 0;
padding-inline-start: 0;
}
.footer_lists {
display: inline-block;
padding: 0px 1rem;
}
.footer_lists a {
color: white;
text-decoration: none;
font-family: 'Oswald', sans-serif;
}
.footer_lists a:hover,
.footer_lists a:active {
color: silver;
}
<footer class="footer">
<ul class="footer_list">
<li class="footer_lists"><a href="about.html">About Us</a></li>
<li class="footer_lists"><a href="Contact.html">Contact</a></li>
<li class="footer_lists"><a href="privacy.html">Privacy Policy</a></li>
</ul>
</footer>
推荐阅读
- python - 通过给定的单个值列表定位数据框中的所有行
- google-sheets - 谷歌表格中的 Sumifs #ref 错误 - 无法解释
- php - HTML + PHP 验证中的日期输入
- jenkins - 使用 jenkins 共享库将工件上传到 S3
- pandas - 如何连续更新数据框列中的每个 NaN 值
- node.js - Mongoose 聚合:MongoError:未知运算符:$ 或
- python-3.x - 如何将两个数组的元组与元组字典映射并处理映射中的划分?
- reactjs - 如何检查 FlatList 是否为空
- python - UnicodeEncodeError :'charmap' 编解码器无法在位置 102 对字符 '\x85' 进行编码:字符映射到
- javascript - 如何跟踪用户使用和提及的命令数量?