, .
<div id="header">
<header role="banner">
<nav id="navigation" role="navigation">
<ul>
<li>
<img src="http://i1207.photobucket.com/albums/bb466/audetwebdesign/jsFiddle%20Demos/chamber-logo.png">
</li>
<li><a href="#" title="About Us">About Us</a>
</li>
<li><a href="#" title="Biographies">Biographies</a>
</li>
<li><a href="#" title="Services">Services</a>
</li>
<li><a href="#" title="Careers">Careers</a>
</li>
<li><a href="#" title="Contact">Contact</a>
</li>
</ul>
</nav>
</header>
</div>
CSS :
#header {
background-color: #cccccc;
padding: 5px 0;
}
header {
background-color: #f0f0f0;
}
header nav {
border: 1px solid red;
}
header nav ul {
margin: 0;
padding: 0;
}
header nav li {
display: inline;
margin: 0;
padding: 0;
}
header nav li img {
vertical-align: middle;
border: 1px solid blue;
}
header nav li a {
vertical-align: middle;
font-size: 1.00em;
text-decoration: none;
background-color: white;
color: black;
padding: 10px;
margin: 0 0 0 10px;
}
<li> . inline vertical-align: middle, .
, , .
: http://jsfiddle.net/audetwebdesign/adW9Y/
Note:
This code also allows you to scale the image size using the viewport.
By adding the following CSS rule:
.autoSize {
width: inherit;
}
.autoSize img {
width: 25%;
}
and adding a class to the markup as follows:
<li class="autoSize">
<img src="http://i1207.photobucket.com/albums/bb466/audetwebdesign/jsFiddle%20Demos/chamber-logo.png">
</li>
As the item ulexpands to the width of the view port, you can inherit the width of the child lithat wraps the image. Then you set the relative width for the image (25% in this example), and you get flexible / flexible scaling.
source
share