【发布时间】:2021-11-29 17:55:23
【问题描述】:
我的导航栏有问题...
- 我想将它定位到中心,但它不会这样做。
- 我想从左到右填充。
我试图: 文本对齐:在 .navbar 中居中 text-align:在导航栏中居中。
.navbar {
background-color: gray;
position: fixed;
top: 0%;
}
.navbar a {
color: white;
text-align: center;
font-family: monospace;
font-size: 20px;
text-decoration: none;
padding: 15px;
display: block;
float: left;
}
.navbar a:hover {
background: lightgray;
color: orange;
}
<div class="navbar">
<a href="../index.html">Home</a>
<a href="Guides.html">Guides</a>
<a href="#">Clips</a>
<a href="#">Leaderborard</a>
<a href="Support the server.html">Support the server</a>
<a href="Help.html">Help</a>
</div>
【问题讨论】:
-
您可能想研究 CSS 网格布局和/或 Flexbox。
标签: html css navigation