jquery - 具有全屏背景的 Bootstrap 响应式页脚

标签 jquery html css twitter-bootstrap twitter-bootstrap-3

我制作了带有全屏轮播、导航栏和页脚的网站。导航栏和图像很好,但是对于我有滚动的页脚,我们能否以这样的方式调整大小,使页脚在没有滚动的情况下进入 1 个屏幕

CSS 代码

html, body { height: 100%;}
.navbar .nav, .navbar .nav > li { float:none; display:inline-block; *display:inline; /* ie7 fix */ *zoom:1; /* hasLayout ie7 trigger */ vertical-align: top; }
.navbar-inner { text-align:center; }
.navbar-nav { font-size:12px;}/*font-family:eurostileregular; */
.navbar {min-height:45px;}
.navbar-inverse { background: rgba(0, 0, 0, 0.5);}
.carousel, .item, .active { height: 100%; }
.carousel-inner { height: 100%; }
.fill { width: 100%; height: 100%; background-position: center; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; -o-background-size: cover;}
.nav li.active a,.nav li:hover a { background:none !important; box-shadow:none !important; border-bottom:2px solid #ad1f2d; padding-bottom: 1px; display:block; }
footer { height:40px;text-align:center;line-height:40px;background-color: #000000;width:100%;color:#fff;position: absolute;left: 0;right: 0;font-size:12px;}
.redBorder { height: 2px; background-color: #ad1f2d; width: 100%; position: absolute; }

HTML代码

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>Demo</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
  <nav class="navbar navbar-inverse navbar-fixed-top navbar-inner" role="navigation">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">PROFILE</a></li>
          <li><a href="#">BUSINESS SOLUTIONS</a></li>
          <li><a href="#">PRODUCTS</a></li>
          <li><a href="#">PARTNERS</a></li>
          <li><a href="#">CAREERS</a></li>
          <li><a href="#">NEWS</a></li>
          <li><a href="#">CONTACT</a></li>
        </ul>
      </div>
    </div>
  </nav>
  <header id="myCarousel" class="carousel slide">
    <div class="carousel-inner">
      <div class="item active">
        <div class="fill" style="background-image: url('images/homepage_slide1.jpg');"></div>
      </div>
      <div class="item">
        <div class="fill" style="background-image: url('images/2.jpg');"></div>
      </div>
      <div class="item">
        <div class="fill" style="background-image: url('images/3.jpg');"></div>
      </div>
    </div>
  </header>
  <div class="container">
    <!-- Footer -->
    <footer class="container-fluid">
      <div class="row redBorder">
      </div>
      <div class="row">
          Copyright PLEXUS 2016. All rights reserved.
      </div>
      <!-- /.row -->
    </footer>

  </div>
  <!-- /.container -->
  <script src="js/jquery.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script>
    $('.carousel').carousel({
      interval: 5000 //changes the speed
    })
    </script>
</body>
</html>

我们可以在 myCarousel 上做一些 CSS 使其响应吗

最佳答案

只需将 bottom: 0; 添加到您的页脚元素即可。

footer 
{ 
    height:40px;
    text-align:center;
    line-height:40px;
    background-color: #000000;
    width:100%;
    color:#fff;
    position: absolute;
    left: 0;
    right: 0;
    bottom:0;//add this
    font-size:12px;
}

关于jquery - 具有全屏背景的 Bootstrap 响应式页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29407548/

相关文章:

php - 下拉(选择菜单)问题

javascript - css 未加载,因为它在 Meteor JS 中的 MIME 类型

jquery - 改变 HTML5 <video> 标签的视角

javascript - 使用粘性导航栏滚动到 div

javascript - 如何使用循环在 Canvas 中的随机位置多次绘制它?

css - 如何使用 CSS 分别为列表项添加下划线?

javascript - Bootstrap 输入组 btn 在 jquery 验证启动后下推

javascript - 如果不包含则隐藏另一个 div

javascript - 滚动时位置固定的响应式导航栏

php - Css,字体大小,WP二十十二主题文本字母(i)小写变成大写谷歌字体