A good fix that I always use is to put <ul> in the <div> as such <div id="nav"><ul>...</ul></div> and then apply the background image to the <div> .
The best answer:
In CSS add display: table-row; into the ul element and display: table-cell; to the elements li . This is better than float: left , as it does not reset your parent element and display: inline-block , since it does not present an annoying gap between the elements.
source share