mardi 5 mai 2015

Vertically align image in li tag without height

I'm trying to vertically align the shopping cart image and have it change on hover as well. I checked the other answers but they all seem involve changing the height.

JSFIDDLE http://ift.tt/1KKFnOs

.navlogo, .navlogo_strip {
z-index:99;  
}
.navlogo img {
width:120px;
margin:10px 10px 10px 10px;
}
.navlogo_strip img {
width:50px;
margin:10px 10px 10px 10px;
}

.floatleft {
float:none;    
}
.floatright {
float:none;    
}

.nav_container ul li {
display: inline-block;
text-align: center;  
line-height:90px;
}

.nav_container ul li a {
padding:50px 30px 50px 30px;
margin:0px;
cursor:pointer;
}

.nav_container ul {
/*  margin-top:15px; */
margin-left:30px;
margin-top:0px;
}

.nav_container {
 text-align: center;
 width:100%;
 font-size:16px;  
 letter-spacing: -1px; 
}
.nav_container ul li:hover {
/* not needed background-color:#08298A; */
}

.nav_container ul li:hover a {
 color:#fff;
 background-color:#08298A;
}
header {
width:100%; 
margin: auto;
min-width:420px;
/* 0 0 8px rgba(0,0,0,0.1)*/
}

HTML

        <div class="navlogo floatleft">
           <a href="http://localhost/auction/"><img src="logo.png" /></a>
        </div>


      <div class="desktopnav">
          <div class="floatleft">

          <div class="nav_container">
              <ul>
                  <li><a href="">Browse</a></li><li><a href="">Sell</a></li>
              </ul>
          </div>

        </div>

       <div class="floatright">

          <div class="nav_container">
              <ul>
                  <li><a href=""><img src="http://ift.tt/1KKFnhg" /></a></li><!-- <li><a href="">Profile</a></li> --><li><a href="">Sign out</a></li>
              </ul>
          </div>

          </div>
        </div>
       <div style="clear:both;"></div>
  </header>

Aucun commentaire:

Enregistrer un commentaire