我正在使用 Twitter Bootstrap 试试运气。我处于起步阶段,只想自定义原始 Carousel 预定义主题 - http://getbootstrap.com/examples/carousel/我已下载并放入我的本地主机。
我使用 Chrome 开发人员工具来查看是否可以根据我的要求将深色背景更改为更令人愉悦的颜色。如果不使用颜色选择器,我什至无法找到它的颜色 - #777777。这与圆圈中的颜色相同。但是 css 中没有提到这种颜色,因为颜色可能是较暗的颜色,不透明度设置为显示较浅的颜色。
我能够更改轮播导航背景渐变,但我一直在努力寻找如何更改背景颜色。
我试图在 css 中搜索背景并检查了 http://bootstrap-live-customizer.com/ (BLC)看看我是否可以定制它。但是这种特殊的颜色不在自定义列表中。然后我从 BLC 下载了 bootstrap.min.css 但结果是一样的
我正在使用 Github docs/examples/carousel 中可用的默认页面
相关部分
<!-- Carousel
================================================== -->
<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>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="first-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" 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="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
CSS 是默认的 bootstrap.min.css,没有任何变化。我尝试更改 .item、.containter、.carousel 上的 css 元素及其变体的背景。
据我所知,Twitter Bootstrap 非常有名,我确信我只是遗漏了一些非常简单的东西,更高级的用户将能够向我展示正确的方法来做到这一点。对于从初始阶段开始的 Bootstrap 的任何迭代,css 都是相同的,因此我没有提供任何 css(因为它太多了,无法展示)。
我四处搜索,发现了一些 stackoverflow 问答,但没有帮助我。
最佳答案
当我想将具有相同颜色的圈子更新为实际图像时,我找到了答案。 css 不起作用,因为背景是通过 src 本身生成的。
src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
此代码创建了灰色背景。将其更改为 nothing 解决了问题。
Here's将 rbg 颜色转换为 base64 的好工具
关于html - 无法更改背景轮播颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29804334/