css3 - Responsive CSS nav behaving strangely -


i've been working on responsive theme wordpress site time now. using media queries determine screen size , adjust layout accordingly. problem i'm facing right in header. working expected until screen between 638 pixels wide , 1023 pixels wide... that's when nav unexpectedly pops on side of screen (it's supposed centered). strange thing not have media query 638-1023. below essential code can see of on website (digitalbrent.com). if tell me why happening (and i've tried on multiple devices, know it's not screen) i'd appreciate it. i'm not quite sure causing nav pop on need fix it.

css:

/******************************** medium screen styles */  @media screen , (min-width: 481px) , (max-width: 1023px){      #titlebox {         margin-top: 38px;         width: 45%;         margin-left: 5%;     }      #sitetitle {         margin-top: 4px;         font-size: 28px;         width: 130px;     }      #tagline{         color:#ffffff;         font-family: georgia bold italic, serif bold italic;         font-size: 18px;         width: 210px;         text-align: center;         margin-left: 0px;         margin-top: 5px;     }      #ctabox{         margin-top: 42px;         width: 45%;         margin-right: 5%;     }      #cta {         color: #27f231;         font-family: georgia bold italic, serif bold italic;         font-size: 18px;         float: left;         position: absolute;         top: 10px;         left: 50%;         width: 224px;         margin-left: -112px;         margin-bottom: 20px;         font-size: 18px;     }      #phone{         color: white;         font-size: 20px;         font-family: ariel, sans-serif;         padding: 16px 0;     }      #headbutton{         margin: 0 auto;         width: 70%;         max-width: 322px;         text-align: center;     }      #nav {         float: left;         margin-top: 10px;         margin-bottom: 12px;         width: 300px;         left: 50%;         margin-left: -150px;     }      #nav ul li{         font-size: 10px;         display: inline-block;         list-style: none;         text-align: center;         font-family: georgia bold italic, serif bold italic;         color: white;         margin-right: 10px;     }      #nav ul li:last-child{         margin-right: 0px;     } 

html:

<div id="header">                 <div id="titlebox">                         <img id="logo" height="70" width="70" src="wp-content/themes/testerthemex/images/web-design.jpg" alt="web designer logo - brent blackwood" />                         <h1 id="sitetitle">brent blackwood</h1>                         <h2 id="tagline">web & graphic design</h2>                 </div>                 <div id="ctabox">                     <span id="cta">call today free quote!</span>                     <h2 id="phone">(801) 4-pro-web</h2>                     <div id="headbutton" class="ctabutton">&nbsp;the cta button!&nbsp;</div>                 </div>                 <div id="nav" class="navscroll">                     <ul>                         <li id="home">                             <div class="navicon"></div>                             home                         </li>                         <li id="blog">                             <div class="navicon"></div>                             blog                         </li>                         <li id="resume">                             <div class="navicon"></div>                             resume                         </li>                         <li id="portfolio">                             <div class="navicon"></div>                             portfolio                         </li>                         <li id="lab">                             <div class="navicon"></div>                             &nbsp;lab&nbsp;                         </li>                         <li id="contact">                             <div class="navicon"></div>                             contact                         </li>                     </ul>                 </div>                 <div class="clean"></div>             </div> 

if #nav supposed centered you'll need to:

  • replace float: left float: none (since you're giving #nav value globally).
  • replace margin-left: -150px (borrowing top/bottom values css) margin: 10px auto 12px.

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -