如何在bootstrap轮播中添加链接到图像?我不希望链接或文本通过旋转木马。我想在每张照片的底部。我的意思是每张照片之后
<div class="container">
<h1 style="margin-left:483px; margin-bottom:50px;"> Projects </h1>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="images/TekClasses.PNG" alt="Los Angeles" style="width:100%;">
<a href="https://www.youtube.com/"></a>
</div>
<div class="item">
<img src="images/sppeder.PNG" alt="Chicago" style="width:100%;">
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<i class="fa fa-chevron-left" style="margin-top:250px;"></i>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<i class="fa fa-chevron-right" style="margin-top:250px;"></i>
<span class="sr-only">Next</span>
</a>
</div>
</div>
答案 0 :(得分:1)
您可以使用一些简单的CSS代码。看看这个https://codepen.io/peshraw-h-ahmed/pen/JvKeME
HTML
<div class="w-25">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="https://via.placeholder.com/350x250" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h5 class="text-dark">Some example text</h5>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/350x250" alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5 class="text-dark">Some example text</h5>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
CSS
.carousel-caption{
display:block;
position:static;
padding:0;
}