在 .menu
display:flex 從左到右
Flex 裡頭還可以包 Flex - 程式碼開發
<div class="header">
<a class="logo" href="#"><img src="https://i.imgur.com/vZsGvLi.png" alt="hexschoollogo"></a>
<ul class="menu">
<li><a href="#">首頁</a></li>
<li><a href="#">關於六角</a></li>
<li><a href="#">問與答</a></li>
</ul>
</div>
*{
outline:1px solid #000;
}
.header{
display:flex;
justify-content:space-between;
align-items:center;
padding:20px;
width: 650px;
margin: 0 auto;
border:1px solid #000;
}
.logo,.menu{
}
.menu{
display:flex;
justifiycontent:flex-start;
width: 210px;
text-align: center;
background: gray ;
justify-content:space-between;
}
.menu li a {
background: gray;
color:#fff;
display:block;
text-decoration:none;
padding: 10px;
padding-bottom: 10px;
}
.menu li a:hover{
background: blue;
color:#00ffa2;
}