Try float: left;
in the list items, maybe something like this:
#navlist li { float: left; list-style-type: none; padding-right: 20px; }
Also, do not forget to specify a height for ul, because the elements will exit the stream, which means that ul will not have any height. You can also use clearfix to fix this behavior:
.clear:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; } .clear { display: inline-block; } html[xmlns] .clear { display: block; } * html .clear { height: 1%; }
Just add class="clear"
to the <ul>
. Google clearfix css for more info :)
source share