How do I correctly locate a div within a list when making a horizontal nav bar with HTML/CSS? -


i'm creating horizontal nav bar in css , icons placed in following order left rigiht: +matthew, gmail, images, 3x3 square block, alarm clock, google plus, smiley face. problem 3x3 square block locates far right , not fit in rest of list. block created using separate div , blocks css. how make can place fourth item left? also, struggling align google plus icon rest of list items. whenever try set seperate padding icon, moves of icons down well. here's code:

<ul>   <li><a class ="headerlink matthew" href="#home">+matthew</a></li>   <li><a class ="headerlink gmail" href="#news">gmail</a></li>   <li><a class ="headerlink images" href="#contact">images</a></li>   <li>     <div id="googleapps"> <a href="https://www.google.com/drive/">         <div class ="googledocs"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     <div class ="square"></div>     </div>           <li> <a class="headerlink alarm" href="https://www.nba.com">&#9742;</a>       </li>      <li><a href="https://plus.google.com/"><img class="headerlink googleplus"      src="http://www.siam.org/publicawareness/images/google-plus-icon.png"></a>      <li><a class="headerlink profpic" href="https://plus.google.com/+matthewthrasher/posts">&#9786;</a></li>  </ul>   #googleapps { height:20px; width:20px; position:relative; float:right; } #googleapps:hover .square { background-color:black; } .headerlink { font-size: 12px; color:#989898; text-decoration:none; font-family:"arial", arial, sans-serif; padding-left:30px; } .matthew:hover, .gmail:hover, .images:hover { text-decoration:underline; } .square { background-color:#737373; float:left; position: relative; width: 30%; padding-bottom: 30.66%; margin:1.66%; } .square:hover { background-color:black; } .drivelink { width:20px; height:20px; background-color:white; color:white; /*important:*/ position:relative; } .alarm { font-size: 25px; } .googleplus { height: 30px; width: 30px; } .profpic { font-size: 30px; } 

i'm not sure if have more css in document you're missing bit of css make menu horizontal.

you can make horizontal adding css:

li {   display: inline-block; } 

extra properties in css pushing squares side.

remove float:right , should align properly.

pretty else caused missing closing tags.

i fixed code , made comments missing: http://jsbin.com/letuwahuqe/1/edit?html,css,output

just tips continue coding - should pay attention formatting , syntax. not sure how you're working on stuff code copy , pasted here has lot of inconsistent spacing in both html , css. makes hard catch mistakes missing tags , difficult other people looking @ code understand.

i recommend using sublime text (it's free!) make life lot easier!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -