简体   繁体   English

如何在实现CSS中更改轮播项目的宽度

[英]how to change width of carousel item in materialize css

i want to change the width and height of the carousel item.i somehow manage to change the height but unable to change its width. 我想更改轮播项目的宽度和高度。我以某种方式设法更改了高度,但无法更改其宽度。

<div class="carousel z-depth-5">
<div class="carousel">
<a class="carousel-item" href="#one!"><img src="https://lorempixel.com/250/250/nature/1"></a>
<a class="carousel-item" href="#two!"><img src="https://lorempixel.com/250/250/nature/2"></a>
<a class="carousel-item" href="#three!"><img src="https://lorempixel.com/250/250/nature/3"></a>
<a class="carousel-item" href="#four!"><img src="https://lorempixel.com/250/250/nature/4"></a>
<a class="carousel-item" href="#five!"><img src="https://lorempixel.com/250/250/nature/5"></a>
 </div>
    </div>

css 的CSS

.carousel-item img{
height: 400px;
width: 300px;
}

.carousel{
height: 700px;
}

It's possible the width is being overwritten by another css rule. 宽度可能被另一个CSS规则覆盖。 Try this: 尝试这个:

.carousel-item img{
height: 400px;
width: 300px !important;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM