I am currently working on a BS 4 carousel with next/prev controls that are functioning well. However, I have a light background and would like to modify the color of the controls which are currently white.
Here is the HTML code:
<div id="carouselQuotes" class="carousel slide quotecaru" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselQuotes" data-slide-to="0" class="active"></li>
<li data-target="#carouselQuotes" data-slide-to="1"></li>
<li data-target="#carouselQuotes" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
... carousel items ...
</div>
<a class="carousel-control-prev" href="#carouselQuotes" 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="#carouselQuotes" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
Changing the color of the indicators was a simple process as it just required adjusting the background color. However, altering the background-color or color property for the prev/next controls did not change the color of the control icon itself.
I discovered that the icons are being set through background-image SVG, with a specific fill color defined:
.carousel-control-prev-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E");
}
I attempted to change the fill color using the following:
.carousel-control-prev-icon, .carousel-control-next-icon {
fill: #000;
}
.carousel-control-prev-icon, .carousel-control-next-icon {
fill: '#000';
}
.carousel-control-prev-icon, .carousel-control-next-icon {
fill: '%23000';
}
Is there a way to modify the color of the icon without overriding the entire background-image property?
Thank you