使用页脚和标题创建单页响应式网站

时间:2014-06-10 13:42:04

标签: html css

在这里,我创建了带有页眉和页脚的单页网站。我使用了固定的页脚和标题。

但是,当点击页面homeabout等时,页脚不会显示。 这是什么问题?

FIDDLE:http://jsfiddle.net/karimkhan/dZTh6/

<div class="navbar navbar-default navbar-fixed-top" role="navigation">

  <div class="container">

    <div class="navbar-header">

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

        <span class="sr-only">Toggle navigation</span>

        <span class="icon-bar"></span>

        <span class="icon-bar"></span>

        <span class="icon-bar"></span>

      </button>

      <a class="navbar-brand" href="#">Project name</a>

    </div>

    <div class="collapse navbar-collapse">

      <ul class="nav navbar-nav">

        <li class="active"><a href="#content1">Home</a></li>

        <li><a href="#content2">About</a></li>

        <li><a href="#content3">Contact</a></li>
        <li><a href="#content4">Portfolio</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li class="dropdown-header">Nav header</li>
            <li><a href="#">Separated link</a></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
    </div><!--/.nav-collapse -->
  </div>
</div>
<!-- Begin page content -->
<div class="container">
  <div class="page-header">
    <h1>Sticky footer with fixed navbar</h1>
  </div>

  <p class="lead">Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS. A fixed navbar has been added with <code>padding-top: 60px;</code> on the <code>body > .container</code>.</p>
<div id="content1" class="content">
</div>
<div id="content2" class="content">
</div>
<div id="content3" class="content">
</div>
<div id="content4" class="content">
</div>
</div>
<div id="footer">
  <div class="container">
    <p class="text-muted">Place sticky footer content here.</p>
  </div>
</div>

1 个答案:

答案 0 :(得分:4)

也许尝试添加位置:固定到页脚而不是绝对(你说你使用了一个固定的页脚,但它是绝对的)