【发布时间】:2020-12-29 13:08:16
【问题描述】:
我正在尝试创建一个站点并从导航栏开始。我正在尝试将徽标居中并给 subs/links(?不知道它们叫什么,a-tags)多一点空间。
我尝试关注一些视频教程和 Stackoverflow 答案,但它们导致左侧 3 个链接更向下,而右侧 3 个链接高于其他所有链接,并导致整体标题大小几乎翻了一番。如果有人可以帮助我,我将不胜感激! :) 可能有一些不需要的垃圾代码,或者总体上是一种不好的做法,但如果不清楚我在网页设计方面是一个完全的初学者:p
body {
margin: 0;
font-family: 'Open Sans', sans-serif;
}
.header {
overflow: hidden;
background-color: #262e28;
padding: 10px 10px;
box-shadow: 0px 2px 8px #888888;
}
.header a {
color: white;
text-align: center;
padding: 12px;
text-decoration: none;
font-size: 14px;
line-height: 25px;
border-radius: 4px;
}
.header a.logo {
font-size: 25px;
color: white;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
.header a:hover {
color: #aeaeae;
}
.header a.active {
color: #aeaeae;
}
.header-right {
float: right;
}
.header-left {
float: left;
}
@media screen and (max-width: 500px) {
.header a {
float: none;
display: block;
text-align: left;
}
.header-right {
float: none;
}
}
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="assets/style.css">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap" rel="stylesheet"></head>
<body>
<div class="header">
<div class="header-right">
<a href="#"><b>1</b></a>
<a href="#"><b>2</b></a>
<a href="#"><b>3</b></a>
</div>
<a href="#" class="logo">LOGO</a>
<div class="header-left">
<a href="#"><b>4</b></a>
<a href="#"><b>5</b></a>
<a href="#"><b>6</b></a>
</div>
</div>
</body>
</html>
【问题讨论】: