bootstrap的carousel为什么不能标题字体颜色?
<html>
<head>
<link rel="stylesheet" href="sample.css">
<link rel="stylesheet" href="./bootstrap-3.3.7-dist/css/bootstrap.min.css">
<script src="jquery.js"></script>
<script src="./bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div id="myCarousel" class="carousel slide">
<!-- 轮播(Carousel)指标 -->
<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>
<!-- 轮播(Carousel)项目 -->
<div class="carousel-inner">
<div class="item active">
<img src="./img/deep.jpg" alt="First slide">
<div class="carousel-caption">标题 1</div>
</div>
<div class="item">
<img src="./img/fog.jpg" alt="Second slide">
<div class="carousel-caption">标题 2</div>
</div>
<div class="item">
<img src="./img/treefog.jpg" alt="Third slide">
<div class="carousel-caption">标题 3</div>
</div>
</div>
<!-- 轮播(Carousel)导航 -->
<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>
</body>
</html>
sample.css
body {
}
#myCarousel{
position:absolute;
top:50%;
left:50%;
}
.active {
height:200px;
width:500px;
transform:translate(-200px,-200px);
}
.item {
height:200px;
}
.carousel-caption{
font-size:20px;
font-family:"fangsong";
color:red;
}
color:red想让“标题1”显示为红色,为什么无效呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
sample.css和bootstrap.min.css引入的顺序反了,两者都有
.carousel-caption
。对于同一选择器,后引入的样式会覆盖之前的。