I want my list (nav) to coincide with the center of the image (logo). I tried to use vertical-align: middle;, but I could not get it to work when I placed the images on the left and right.
Here is my code:
HTML:
<div id="head">
<img id="logo" src="logo.png" />
<ul id="nav">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
</ul>
</div>
CSS
#head {
margin-top: 2px;
width: 100%;
}
#logo {
float: left;
}
ul#nav {
float: right;
}
ul#nav li {
display: inline;
list-style-type: none;
}
I took everything vertical-align: middle;from the place where I placed them (I tested it in every element, although it should only apply to #logo, from what I read.)
In any case, any help would be appreciated.
source
share