【发布时间】:2021-12-30 20:07:16
【问题描述】:
我很难在导航栏上正确对齐内容。我希望单词(home、players、about、contact)垂直对齐到心形标志的中间。
这就是现在的样子:
我希望它看起来像这样(在 Photoshop 上完成)
我现在的代码是:
body {
padding: 0;
margin: 0;
font-size: 15px;
font-family: Arial, Helvetica, sans-serif;
line-height: 1.5;
background-color: whitesmoke;
}
.container {
width: 80%;
margin: auto;
}
/* Header */
header {
background: black;
color: whitesmoke;
padding-top: 30px;
min-height: 50px;
border-bottom: #fe1d61 4px solid;
}
header a {
color: whitesmoke;
text-decoration: none;
font-size: 16px;
font-weight: bold;
}
header ul {
margin: 0;
padding: 0 0 20px 0;
list-style-type: none;
text-align: center;
}
header li {
display: inline;
padding: 0 100px 0 100px;
height: 30px;
}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<body>
<header>
<div class="container">
<nav>
<ul>
<li><a href="index.html">HOME</a></li>
<li><a href="players.html">PLAYERS</a></li>
<li>
<a href="index.html"><img src="img/00nation_logo.png" width="60px"></a>
</li>
<li><a href="about.html">ABOUT</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
</nav>
</div>
</header>
</body>
很抱歉,如果已经有关于同一件事的问题,但我尝试查找它并找不到任何东西。
【问题讨论】: