为滑块增加高度

时间:2015-07-19 18:40:32

标签: twitter-bootstrap

我有导航栏,除了是滑块,然后是其他容器。问题是滑块和下一个容器之间的空间是大的。我想知道的是:如何为我的滑块增加更高的高度,并使滑块和下一个容器之间的距离更短

这是我的代码:

    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="utf-8">
        <title>My Logo</title>
        <meta name="description" content="Wiredwiki App">
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="custom.css">

        <!-- Optional theme -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
    </head>

        <style>
        body{
            padding-top: 50px;
        }
        </style>

    <body data-spy="scroll" data-target="#my-navbar">

      <div class="navbar navbar-inverse navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
        <a class="navbar-brand" href="#">
            <!-- <img id="brand-image" alt="Website Logo" src="111.png" />-->
            <a class="navbar-brand" href="#"></a>
        </a>
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav navbar-right">
                       <li><a href="#feedback"><span class="glyphicon glyphicon-user"></span> O mnie</a> 
                        <li><a href="#gallery"><span class="glyphicon glyphicon-credit-card"></span> Aplikacje komputerowe</a> 
                        <li><a href="#features"><span class="glyphicon glyphicon-th-large"></span> Strony internetowe</a> 
                        <li><a href="#faq"><span class="glyphicon glyphicon-headphones"></span> Nauka IT</a> 
                        <li><a href="#contact"><span class="glyphicon glyphicon-earphone"></span>Kontakt</a> 
                    </ul>
                </div>
            </div>
        </div>


        <div class="carousel slide" id="myCarousel">
          <div class="carousel-inner">
            <div class="item active">
              <img src="street.jpg">
              <div class="container">
                <div class="carousel-caption">
                  <h1>Example headline.</h1>
                  <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                  <a class="btn btn-large btn-primary" href="#">Sign up today</a>
                </div>
              </div>
            </div>
            <div class="item">
              <img alt="" src="rp_salvation0022.jpg">
              <div class="container">
                <div class="carousel-caption">
                  <h1>Another example headline.</h1>
                  <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                  <a class="btn btn-large btn-primary" href="#">Learn more</a>
                </div>
              </div>
            </div>
            <div class="item">
              <img alt="" src="river.jpg">
              <div class="container">
                <div class="carousel-caption">
                  <h1>One more for good measure.</h1>
                  <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                  <a class="btn btn-large btn-primary" href="#">Browse gallery</a>
                </div>
              </div>
            </div>
          </div>
          <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
          <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
        </div><!-- /.carousel -->
    ....
<!-- Feedback-->
    <div class="container" id="moj">
        <section>
            <div class="page-header" id="feedback">
                <h2>Kilka słów o mnie.<small> couple words about myself</small></h2>
            </div>

自定义css:

#feedback
{
padding-top: 50px;
}


    /* CUSTOMIZE THE CAROUSEL
    -------------------------------------------------- */

    /* Carousel base class */
    .carousel {
      margin-bottom: 60px;
    }

    .carousel .container {
      position: relative;
      z-index: 9;
    }

    .carousel-control {
      height: 80px;
      margin-top: 0;
      font-size: 120px;
      text-shadow: 0 1px 1px rgba(0,0,0,.4);
      background-color: transparent;
      border: 0;
      z-index: 10;
    }

    .carousel .item {
      height: 500px;
    }
    .carousel img {
      position: absolute;
      top: 0;
      left: 0;
      min-width: 100%;
      height: 500px;
    }

    .carousel-caption {
      background-color: transparent;
      position: static;
      max-width: 550px;
      padding: 0 20px;
      margin-top: 200px;
    }
    .carousel-caption h1,
    .carousel-caption .lead {
      margin: 0;
      line-height: 1.25;
      color: #fff;
      text-shadow: 0 1px 1px rgba(0,0,0,.4);
    }
    .carousel-caption .btn {
      margin-top: 10px;
    }



    /* MARKETING CONTENT
    -------------------------------------------------- */

    /* Center align the text within the three columns below the carousel */
    .marketing .span4 {
      text-align: center;
    }
    .marketing h2 {
      font-weight: normal;
    }
    .marketing .span4 p {
      margin-left: 10px;
      margin-right: 10px;
    }


    /* Featurettes
    ------------------------- */

    .featurette-divider {
      margin: 80px 0; /* Space out the Bootstrap <hr> more */
    }
    .featurette {
      padding-top: 120px; /* Vertically center images part 1: add padding above and below text. */
      overflow: hidden; /* Vertically center images part 2: clear their floats. */
    }
    .featurette-image {
      margin-top: -120px; /* Vertically center images part 3: negative margin up the image the same amount of the padding to center it. */
    }

    /* Give some space on the sides of the floated elements so text doesn't run right into it. */
    .featurette-image.pull-left {
      margin-right: 40px;
    }
    .featurette-image.pull-right {
      margin-left: 40px;
    }

    /* Thin out the marketing headings */
    .featurette-heading {
      font-size: 50px;
      font-weight: 300;
      line-height: 1;
      letter-spacing: -1px;
    }



    /* RESPONSIVE CSS
    -------------------------------------------------- */

    @media (max-width: 979px) {

      .container.navbar-wrapper {
        margin-bottom: 0;
        width: auto;
      }
      .navbar-inner {
        border-radius: 0;
        margin: -20px 0;
      }

      .carousel .item {
        height: 500px;
      }
      .carousel img {
        width: auto;
        height: 500px;
      }

      .featurette {
        height: auto;
        padding: 0;
      }
      .featurette-image.pull-left,
      .featurette-image.pull-right {
        display: block;
        float: none;
        max-width: 40%;
        margin: 0 auto 20px;
      }
    }


    @media (max-width: 767px) {

      .navbar-inner {
        margin: -20px;
      }

      .carousel {
        margin-left: -20px;
        margin-right: -20px;
      }
      .carousel .container {

      }
      .carousel .item {
        height: 300px;
      }
      .carousel img {
        height: 300px;
      }
      .carousel-caption {
        width: 65%;
        padding: 0 70px;
        margin-top: 100px;
      }
      .carousel-caption h1 {
        font-size: 30px;
      }
      .carousel-caption .lead,
      .carousel-caption .btn {
        font-size: 18px;
      }

      .marketing .span4 + .span4 {
        margin-top: 40px;
      }

      .featurette-heading {
        font-size: 30px;
      }
      .featurette .lead {
        font-size: 18px;
        line-height: 1.5;
      }

    }

和图片: enter image description here

1 个答案:

答案 0 :(得分:1)

在你的CSS中:

.carousel {
  margin-bottom: 60px;
}

将此边距底部减少到0,另外:

#feedback
{
padding-top: 50px;
}

将此填充更改为0。