If you want make a navigation to center of menu (stay on center). Try this :
.menu{
width: 100%;
height: 65px;
margin-bottom: 0.5%;
margin-top:5px;
}
.search{
width: 300px;
height: 65px;
float:left;
z-index: 1;
}
.navigation{
width:300px; /* you can change this */
left: 50%; /* you can change this */
margin-left: -150px; /* you can change this */
height: 65px;
display:inline-block;
position: absolute;
}
First,
left: 50%
. this will move the left-hand edge of the navigation to the center.use a negative left margin that’s half its width (width of navigation div :
300px
). In our example, must setmargin-left
to-150px
to shift the box back to the right place
Update 2015
You can do it without 'position', you can use flexbox
.menu {
width: 100%;
height: 65px;
margin-top: 5px;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-justify-content: center;
justify-content: center;
}
.search{
width: 300px;
height: 65px;
margin-left:10px;
}
.navigation{
width:300px;
height: 65px;
margin:0 auto;
margin-left:220px;
}
.navigation ul {
list-style:none;
margin-top:5px;
}
.navigation ul li {
float:left;
margin-left:5px;
border:solid 1px;
}