Problem :
** The left part ** (#nav ul li) which float: left
and ** the right part ** (#nav .search) which float: right
** are not in a line **.
It should look like this: 
, but my: 
HTML:
<div id="nav"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> </ul> <div class="search"> <input type="text" name="search" id="search" value="search"> </div>
CSS:
#nav ul li{ float: left; list-style: none; margin: 0 20px; } #nav .search{ float: right; }
My solutions:Solution 1 Use bootsrap to create a layout instead of doing it yourself, I use it on the footer and it works fine on one line! But I still don't know how it works 
Solution 2 I use margin-top: -20px to pull out the search box, but I don't think this is good practice.
Anyone can help? Many thanks!
Alex g
source share