如何更改引导程序轮播控制链接的大小?

Ton*_*y M 3 html css twitter-bootstrap

默认引导程序轮播控件(左箭头和右箭头)具有跨越轮播中图像高度 100% 的链接。我很抱歉,因为这可能是一个愚蠢的问题,但是如何更改它以使链接仅超过箭头本身的宽度和高度?

您可以在 Boostrap 文档( https://getbootstrap.com/docs/3.3/javascript/#carousel )上的“Carousel”下查看我的意思的示例,并且轮播的代码如下。

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="..." alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item">
      <img src="..." alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    ...
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
Run Code Online (Sandbox Code Playgroud)

小智 5

我在进行 Google 搜索后最终来到这里,我自己找到了解决方案,因此我添加了 Bootstrap 4.x 的解决方案,以便其他人可以找到这个简单的解决方案。由于图标是 SVG,调整高度和宽度都会改变图标的​​大小。我原以为如果我增加宽度,它们会改变大小,但事实并非如此。我使用的vw是它们随着屏幕缩放,但你可以使用任何你想要的单位。

.carousel-control-next-icon,
.carousel-control-prev-icon {
  width: 5vw;
  height: 5vw;
}
Run Code Online (Sandbox Code Playgroud)