Aloha,
I'm working (still) on the bootstrap website and want to apply a (inset!) shadow to the carousel. HTML looks like this:
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<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>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img src="..." alt="First slide">
</div>
<div class="carousel-item">
<img src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img src="..." alt="Third slide">
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="icon-prev" 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="icon-next" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
Tried to apply via
.carousel-item {
box-shadow: inset 0 0 20rem rgba(0,0,0,1);
}
.carousel-item img {
z-index: -1;
}
(and a few others which did not work).
Anybody got an idea how to fix this?
The image is hiding the shadow. Use a pseudo element with the box-shadow instead..
.carousel-item:before {
-webkit-box-shadow: inset 0 0 20rem rgba(0, 0, 0, 1);
box-shadow: inset 0 0 20rem rgba(0, 0, 0, 1);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
content: "";
}
I think the inset shadow is here, but no visible, then the picture fill the container.
try this:
.carousel-item{
padding: 20rem
box-shadow: inset 0 0 20rem rgba(0,0,0,1);
}
or read this: http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_carousel2&stacked=h
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.