You need to take the default margin of body
:
body {
background: #f9f9eb;
margin: 0; ← ← ← ← ← ← ← ←
}
Also take the padding
of the <ul>
, which is the .navigation
class:
.navigation {
list-style: none;
margin: 0;
padding: 0; ← ← ← ← ← ← ← ←
background: #0b5eec;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
justify-content: center;
}
The div
that holds your search box is out of nav
:
<nav>
...
</nav>
<div class="search-box">
...
</div>
Place at the end of nav
and insert into CSS the styles to center and give a top margin of the menu:
.search-box{
text-align: center;
margin-top: 15px;
}
How it works:
body {
background: #f9f9eb;
margin: 0;
}
nav{
background: #0b5eec;
}
.navigation {
list-style: none;
margin: 0;
padding: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
justify-content: center;
}
.search-box{
margin: 15px 15px 0;
}
.navigation a {
text-decoration: none;
display: block;
padding: 15px;
color: white;
}
.navigation a:hover {
background: #000;
text-decoration: underline;
}
<header>
<nav>
<ul class="navigation">
<li>
<div class="search-box">
<label>
<input name="search-box" value="Search..."/>
</label>
</div>
</li>
<li><a href="#">Index</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>