html - 更改轮播左/右位置 - Bootstrap-3/HTML

标签 html css twitter-bootstrap-3 carousel

我使用 bootstrap-3 在轮播中设置了一些 WebView 。用于移动的左/右箭头太大,挡住了我页面的某些部分。如何修剪它们,使它们更小。我试过反复试验来更改 css,但没有成功。

enter image description here

.carousel {
  position: relative;
}

.carousel-inner {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-inner>.item {
  position: relative;
  display: none;
  -webkit-transition: .30s ease-in-out left;
  -o-transition: .30s ease-in-out left;
  transition: .30s ease-in-out left;
}

.carousel-inner>.item>img,
.carousel-inner>.item>a>img {
  line-height: 1;
}

@media all and (transform-3d),
(-webkit-transform-3d) {
  .carousel-inner>.item {
    -webkit-transition: -webkit-transform .30s ease-in-out;
    -o-transition: -o-transform .30s ease-in-out;
    transition: transform .30s ease-in-out;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
  }
  .carousel-inner>.item.next,
  .carousel-inner>.item.active.right {
    left: 0;
    -webkit-transform: translate3d(100%, 0, 0);
    transform: translate3d(100%, 0, 0);
  }
  .carousel-inner>.item.prev,
  .carousel-inner>.item.active.left {
    left: 0;
    -webkit-transform: translate3d(-100%, 0, 0);
    transform: translate3d(-100%, 0, 0);
  }
  .carousel-inner>.item.next.left,
  .carousel-inner>.item.prev.right,
  .carousel-inner>.item.active {
    left: 0;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}

.carousel-inner>.active,
.carousel-inner>.next,
.carousel-inner>.prev {
  display: block;
}

.carousel-inner>.active {
  left: 0;
}

.carousel-inner>.next,
.carousel-inner>.prev {
  position: absolute;
  top: 0;
  width: 100%;
}

.carousel-inner>.next {
  left: 100%;
}

.carousel-inner>.prev {
  left: -100%;
}

.carousel-inner>.next.left,
.carousel-inner>.prev.right {
  left: 0;
}

.carousel-inner>.active.left {
  left: -100%;
}

.carousel-inner>.active.right {
  left: 100%;
}

.carousel-control {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 15%;
  font-size: 20px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  background-color: rgba(0, 0, 0, 0);
  filter: alpha(opacity=50);
  opacity: .5;
}

.carousel-control.left {
  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
  background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001)));
  background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
  background-repeat: repeat-x;
}

.carousel-control.right {
  right: 0;
  left: auto;
  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
  background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5)));
  background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
  background-repeat: repeat-x;
}

.carousel-control:hover,
.carousel-control:focus {
  color: #fff;
  text-decoration: none;
  filter: alpha(opacity=90);
  outline: 0;
  opacity: .9;
}

.carousel-control .icon-prev,
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: inline-block;
  margin-top: -10px;
}

.carousel-control .icon-prev,
.carousel-control .glyphicon-chevron-left {
  left: 50%;
  margin-left: -10px;
}

.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-right {
  right: 50%;
  margin-right: -10px;
}

.carousel-control .icon-prev,
.carousel-control .icon-next {
  width: 20px;
  height: 20px;
  font-family: serif;
  line-height: 1;
}

.carousel-control .icon-prev:before {
  content: '\2039';
}

.carousel-control .icon-next:before {
  content: '\203a';
}

.carousel-indicators {
  position: absolute;
  bottom: 10px;
  left: 50%;
  z-index: 15;
  width: 60%;
  padding-left: 0;
  margin-left: -30%;
  text-align: center;
  list-style: none;
}

.carousel-indicators li {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 1px;
  text-indent: -999px;
  cursor: pointer;
  background-color: #000 \9;
  background-color: rgba(0, 0, 0, 0);
  border: 1px solid #fff;
  border-radius: 10px;
}

.carousel-indicators .active {
  width: 12px;
  height: 12px;
  margin: 0;
  background-color: #fff;
}

.carousel-caption {
  position: absolute;
  right: 15%;
  bottom: 20px;
  left: 15%;
  z-index: 10;
  padding-top: 20px;
  padding-bottom: 20px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

.carousel-caption .btn {
  text-shadow: none;
}

@media screen and (min-width: 768px) {
  .carousel-control .glyphicon-chevron-left,
  .carousel-control .glyphicon-chevron-right,
  .carousel-control .icon-prev,
  .carousel-control .icon-next {
    width: 30px;
    height: 30px;
    margin-top: -10px;
    font-size: 30px;
  }
  .carousel-control .glyphicon-chevron-left,
  .carousel-control .icon-prev {
    margin-left: -10px;
  }
  .carousel-control .glyphicon-chevron-right,
  .carousel-control .icon-next {
    margin-right: -10px;
  }
  .carousel-caption {
    right: 20%;
    left: 20%;
    padding-bottom: 30px;
  }
  .carousel-indicators {
    bottom: 20px;
  }
}
<div class="col-xs-2 col-md-10 col-md-push-1" style="margin-top:20px; margin-bottom:20px;">
  <div class="carousel slide" data-ride="carousel" id="carousel-example-generic">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li class="active" data-slide-to="0" data-target="#carousel-example-generic"></li>
      <li data-slide-to="1" data-target="#carousel-example-generic"></li>
      <li data-slide-to="2" data-target="#carousel-example-generic"></li>
    </ol>
    <!-- Wrapper for slides -->
    <div class="carousel-inner">
      <div class="item active">
        <div>
          <webview partition="persist:test1" src="www.google.com" style="width:100%; height:1480px"></webview>
        </div>
      </div>
      <div class="item">
        <div>
          <webview partition="persist:test1" src="www.google.com" style="width:100%; height:1480px"></webview>
        </div>
      </div>
      <div class="item">
        <div>
          <webview partition="persist:test1" src="www.google.com" style="width:100%; height:1480px"></webview>
        </div>
      </div>
      <!-- Controls -->
      <a class="left carousel-control" data-slide="prev" href="#carousel-example-generic" role="button"><span class="glyphicon glyphicon-chevron-left"></span></a>
      <a class="right carousel-control" data-slide="next" href="#carousel-example-generic" role="button"><span class="glyphicon glyphicon-chevron-right"></span></a>
    </div>
    <!-- Carousel -->
  </div>
</div>
<div class="col-xs-2 col-md-10 col-md-push-1" style="margin-top:20px; margin-bottom:20px;">
  <div class="carousel slide" data-ride="carousel" id="carousel-example-generic1">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li class="active" data-slide-to="0" data-target="#carousel-example-generic1"></li>
      <li data-slide-to="1" data-target="#carousel-example-generic1"></li>
      <li data-slide-to="2" data-target="#carousel-example-generic1"></li>
    </ol>
  </div>
</div>

最佳答案

编辑以下 CSS:

.carousel-control {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8%;  /* change this value to required width */
  font-size: 20px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  background-color: rgba(0, 0, 0, 0);
  filter: alpha(opacity=50);
  opacity: .5;
}

关于html - 更改轮播左/右位置 - Bootstrap-3/HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44386456/

相关文章:

JavaScript - 检查选择框中的唯一值

html - 在 CSS 中裁剪除图像之外的背景

javascript - 如何在显示下拉菜单项时使导航栏响应

jquery - Bootstrap 阻止 jQuery 更改复选框的状态

html - 影响顶部的颜色过渡‽

javascript - 刷新页面后本地存储项

html - 悬停时阻止表格元素移动位置?

html - 如何像在 facebook 上那样在 div 外部制作带有滚动条的可滚动 DIV?

css - 删除默认填充后,bootstrap 4 容器流体不是全宽

twitter-bootstrap-3 - 如何使用 Grunt 构建 Twitter Bootstrap 3