KPO
KPO

Reputation: 880

Which property do I use to align my logo with my navigation?

I asked a related question a few minutes ago through which I got this updated code but I can't figure out how to get my logo to show up on the left hand side.

HTML:

 <header>
 <img src="/images/logo.png" height="50px" id="front" />
 <nav>
 <ul>
 <li><a href="#">Home</a></li>
 <li><a href="#">About</a></li>
 <li class="last"><a href="#">Contact</a></li>
 </ul>
 </nav>
 <div id="second_line"></div>
 </header>

CSS:

 body {
 margin: 0;
 }
 header {
 background-color: #009000;
 height: 85px;
 position: relative;
 }
 #front {
 margin-left: 20px;
 margin-top: 20px;
 }
 nav {
 float: left;
 margin-top: 30px;
 }
 ul {
 margin: 0;
 padding: 0;
 float: left;
 }
 ul li {
 list-style-type: none;
 float: left;
 border-right: 2px solid black;
 padding-right: 5px;
 padding-left: 5px;
 }
 ul li.last {
 border-right: 0px;
 }
 #second_line {
 margin-top:10px;
 height:3px;
 background-color: #FECE2C;
 }

How do I fix this so that the logo is on the left not the right?

Thanks!

Upvotes: 0

Views: 63

Answers (3)

Jonathan Lonowski
Jonathan Lonowski

Reputation: 123423

You might try adjusting the <nav> to inline-block:

nav {
    display: inline-block;
}

Example

Upvotes: 1

james
james

Reputation: 202

demo

you just miss adding this style.

header img{float:left;}

Upvotes: 0

daniel
daniel

Reputation: 1433

Try adding this to your stylesheet:

header > img {float:left;}

Upvotes: 1

Related Questions