我有一个问题,我的手机屏幕上的滑块非常小我试图使用媒体查询,使其在移动屏幕上更大,但没有工作 这是我的滑块代码
<section id="watch-app">
<h2 class="watch-head">watch app</h2>
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="imgs/watch-app.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="imgs/watch-app1.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="imgs/watch-app.jpg" alt="Third slide">
</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>
</a>
</div>
</section>
这是该部分的css代码
#watch-app{
padding: 7rem;
text-align: center;
}
.img-fluid{
margin: 0 auto;
max-width: 650px;
padding-top: 6rem;
}
.carousel-indicators li{
width: 20px;
height: 20px;
background-color:white;
border-radius: 50%;
border: 1px solid #f16054;
}
.carousel-indicators {
bottom: -5rem;
}
.carousel-indicators .active{
background-color:#ef473a;
}
.carousel-control-next-icon{
width: 90px;
height: 80px;
background-image: url(../imgs/right-arrow.jpg);
margin-top: 5rem;
}
.carousel-control-prev-icon{
width: 90px;
height: 80px;
background-image: url(../imgs/left-arrow.png);
margin-top: 5rem;
}
这是我的媒体查询
@media (max-width: 768px) {
.img-fluid{
max-width: 900px;
margin: 0 auto;
}
}
这是我的滑块在普通屏幕中的样子 normal screen 以及它在移动屏幕上的样子 mobile screen
答案 0 :(得分:1)
您必须使用最大宽度
添加width: 100%;