简体   繁体   中英

which selector to make navigation bar fixed and scroll with the page?

heres the site http://designobvio.us/DoUs/directPro.html

anyone know which selector I'd target to make my navigation bar scroll.

when i've tried it fixed broke my grid, If you could please give me a css snippet with the correct selector(s) i'd be very thankful!

<nav id="nav" class="grid_2">
  <ul>
   <a href="#"> <li><span>↗</span>Portfolio </li></a>
   <a href="#"> <li>Blog</li></a>
    <a href="#"><li>About Me</li></a>
    <ul class="secondaryUL">
    <a href="#"><li>business</li></a>
    <a href="#"><li>skills</li></a>
    <a href="#"><li>service</li></a>
 <a href="#"><li>me</li></a>
   <a href="#"><li>contact</li></a>
  </ul>
    </ul>
</nav>

Matthew

First thing First, i think u mst layout correctly ie

<nav id="nav" class="grid_2">    
  <ul>
    <li><a href="#"><span>↗</span>Portfolio</a></li>
    <li><a href="#">Blog</a></li>
    <li><a href="#">About Me</a></li>
    <li>
        <ul class="secondaryUL">
           <li><a href="#">business</a></li>
           <li><a href="#">skills</a></li>
           <li><a href="#">service</a></li>
        </ul>
    </li>
    <li><a href="#">me</a></li>
    <li><a href="#">contact</a></li>
 </ul>    
</nav>

After then u can fixed the position of nav#id ie
#nav{float:left;position:fixed}

If you can't use CSS:

#nav{
    position: fixed;
}

Then you'll need to rely on a javascript fix to force a variable margin-top on #id .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM