如何制作以公司徽标为中心的导航栏



我想要实现的布局 我已经完成了导航栏的上半部分,我正在尝试完成第二部分,其中框(代表单词(,我在图像中圈出。我试图像图像所示直接使徽标标志下方的部分居中,但我不确定如何做到这一点。

body {
margin: 0;
font-weight: 800;
}
.container {
width: 80%;
height: 100%;
margin: 0 auto;
display: flex;
/* align-items: center; */
justify-content: center;
}
header {
background: #ffe9e3;
height: 100px;
}
.logo {
text-align: center;
margin: 0;
display: block;
}
.business {
position: absolute;
right: 0;
top: 0;
padding: 10px;
}
.menu {}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
}
nav a {
color: #444;
text-decoration: none;
text-transform: uppercase;
font-size: 14px;
}
nav a:hover {
color: #000;
}
nav a::before {
content: '';
display: block;
height: 5px;
background-color: #444;
position: absolute;
top: 0;
width: 0%;
transition: all ease-in-out 250ms;
}
nav a:hover::before {
width: 100%;
}
<header>
<div class="container">
<h1 class="logo"><i>LOGO</i></h1>
<nav class=m enu>
<ul>
<li><a href="#">Hair</a></li>
<li><a href="#">Nails</a></li>
<li><a href="#">Makeup</a></li>
<li><a href="#">Face</a></li>
</ul>
</nav>
<nav class=b usiness>
<ul>
<li><a href="#">List Your Business</a></li>
</ul>
</nav>
<<div class="menu">
<nav>
</nav>
</div>
</div>
</header>

我已经按照您希望它的外观完成了

CSS部分 :

* {
padding: 0;
margin: 0;
}
body {
background: #333333;
min-width: 100vw;
min-height: 100vh;
}
.header {
height: 150px;
background: pink;
}
.logo {
padding: 10px;
text-align: center;
}
.nav > ul {
display: flex;
justify-content: space-evenly;
padding: 10px;
margin-top: 20px;
}
.nav > ul > li {
width: 100px;
list-style: none;
border: 2px solid #000;
border-radius: 20px;
}
.nav > ul > li > a {
text-decoration: none;
color: #fff;
font-size: 1.3rem;
padding: 3px 5px;
display: flex;
justify-content: center;
}

在此处检查整个代码:https://codepen.io/the-wrong-guy/pen/GRoyKMa?editors=1100

而且你犯了很多语法错误,比如没有给类名加双引号

最新更新