定位元素在bootstrap轮播内

时间:2015-10-31 12:15:51

标签: html5 css3 twitter-bootstrap-3

我正在尝试将一个羽绒V形灯放到我的旋转木马上,但是V形符号出现在旋转木马容器外面。我想要这样的东西:

http://www.yummygum.com

我的HTML代码:

<div id="myCarousel" class="carousel slide" data-ride="carousel">
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img class="img-rounded" src="images/biz%20bznner.png" alt="First slide">
      <div class="container ccontainers">
        <div class="carousel-caption">
          <h1 class="animated rubberBand 1">You have a project? Let Us Do it for you</h1>
          <h3 class="animated bounceInLeft">We will do your projects with the best prices</h3>
          <p><a class="btn btn-lg btn-primary animated shake 1" href="#" role="button">Sign up today</a></p>
        </div>
      </div>
    </div>
  </div>
  <a class="chevron-down" href="#myCarousel" role="button">
    <span class="glyphicon glyphicon-chevron-down" aria-hidden"true"></span>
  </a>

</div>

我的CSS:

.carousel-control.right, .carousel-control.left {
background-image: none;
}

.carousel .item {
    height: 100vh;
    margin-bottom: 60px;
}

.carousel {
  height: 100vh;
  width:100%; 
}


.carousel-caption {
  z-index: 10;
  margin-top: 0%;
  margin-bottom: 5%;
}

.carousel-caption h3 {
    padding: 0.5em;
    animation-delay: 0.5s;
}

.chevron-down{
    **margin-bottom:100px** //THIS DOES NOT WORK
    margin-left: 50%;
    font-size: 30px;
}

.carousel-caption a{
    background-color: orangered;
    border-color: darkred;
    margin-top: 1em; 
    animation-delay: 2s;
}

.carousel-caption h1 {
  text-align: center;  
  margin-bottom: 30px;
  font-size: 30px;
  font-weight: bold;
  animation-delay: 0s;
}

.carousel-inner > .item > img {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  height: 100vh;
}

所以在.chevron-down类中,左边有效,但是当我试图垂直移动雪佛龙时它没有做任何事情。这样做的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

您可以这样做:

.chevron-down {
  font-size: 30px;
  position: relative;
  bottom: 100px;
}

CODEPEN