I'm working on a sleek top menu design that features a logo on the left and inline links on the right:
* { margin:0; padding: 0; }
#header { background-color: grey; }
#right { background-color: blue; float:right; }
#left { background-color: green; float:left; }
li { display:inline-block; padding: 0 30px; }
<div id="header">
<div id="left">LOGOLOGOLOGOLOGOLOGOLOGO</div>
<div id="right">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
</div>
I want to ensure that:
when the browser width allows for everything to be inline, the list of links should align to the right (
float: right
)when the browser width does not allow for everything to be inline, the list of links should align to the left
How can I achieve this using the code mentioned above?
Note: The "wrap effect" should only occur precisely when
width(#left)+width(#right)>width(browser)
and not based on a static value like width(browser)<300px
.