当div标签被修复时,如何使用导航栏固定? [英] how to use nav bar as fixed , when div tags are fixed ?

查看:93
本文介绍了当div标签被修复时,如何使用导航栏固定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从头开始建立一个网站,我开始添加导航栏似乎工作正常,之后我添加了几个div标签为固定。



我需要它以这样一种方式,当我滚动时,导航栏应该是固定的,其余的内容将滚动...





当我试图让导航栏固定时... div标签正在导航栏上方移动



我已经附上了以下项目





app.box.com/s/5iyj5jc5n3gzah5xwpyt

I wanted to build a website from scratch, I started adding nav bar which seems to work fine and after that I added a few div tags as "fixed".

I need it to be in such a way that when I scroll, the nav bar should be fixed and the rest of the content to be scrolled...


When I tried to make the nav bar fixed .. the div tag was moving above the nav bar

I have attached the project below


app.box.com/s/5iyj5jc5n3gzah5xwpyt

推荐答案

关于实现某些区域滚动的方法,同时保持页面的顶部到位,一个非常简单的方法,就是:

On of the ways to achieve the scrolling of some area while keeping, say, the top portion of the page in place, a very simple one, would be this:
.scrollable { style="overflow-y: scroll; height: 600px; }



考虑以下原型HTML:


Consider the following prototype HTML:

<p>You header content goes here; navigation bad, for example</p>
<div class="scrollable">
    <!-- The rest of the page goes here; it will be scrollable -->
</div>



考虑到这一点作为一个开始的想法。



一些更高级的想法: http://webdesign.about.com/od/advancedcss/qt/html-scroll-box-with-css.htm [ ^ ]。



另请参阅: http://www.w3.org/wiki/CSS /属性/溢出 [ ^ ] 。



-SA


Consider this just as a starting idea.

Some more advanced ideas: http://webdesign.about.com/od/advancedcss/qt/html-scroll-box-with-css.htm[^].

See also: http://www.w3.org/wiki/CSS/Properties/overflow[^].

—SA


这篇关于当div标签被修复时,如何使用导航栏固定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆