フレックスボックスで同じサイズの画像を作成しようとしています。私はdisplay: flex;
を私のslick-track
のコンテナに与え、次にflex: 1 0 auto
を私のimg
に与えます。私はflex-grow
が1
であると思っていましたが、小さすぎるとイメージが大きくなりますが、それは起こらなかったでしょう。フレックスボックスで同じ高さの画像
$(".image-carousel").slick({
// autoplay: true,
dots: true,
\t slidesToShow:3,
\t
});
.slick-track {
display: flex;
}
.slick-track .slick-slide img {
flex: 1 0 auto;
align-items: center;
justify-content: center;
}
<div class="image-carousel">
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/gene-300x168.jpg" alt="noo">
<figcaption class="elementor-image-carousel-caption">gene</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/chimie-300x225.jpeg" alt="chimie">
<figcaption class="elementor-image-carousel-caption">chimie</figcaption>
</figure>
</div>
<div class="slick-slide ">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/cerveau-300x180.jpg" alt="cerveau">
<figcaption class="elementor-image-carousel-caption">cerveau</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/cropped-Science-300x300.jpg" alt="mpo">
<figcaption class="elementor-image-carousel-caption">cropped-Science.jpg</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/ordi-300x169.jpg" alt="pôo">
<figcaption class="elementor-image-carousel-caption">ordi</figcaption>
</figure>
</div>
<div class="slick-slide ">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/astro-300x188.jpg" alt="captiopn 1">
<figcaption class="elementor-image-carousel-caption">astro</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/Einstein-300x169.jpg" alt="roo">
<figcaption class="elementor-image-carousel-caption">Einstein</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/gene-300x168.jpg" alt="noo">
<figcaption class="elementor-image-carousel-caption">gene</figcaption>
</figure>
</div>
<div class="slick-slide">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/chimie-300x225.jpeg" alt="chimie">
<figcaption class="elementor-image-carousel-caption">chimie</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/cerveau-300x180.jpg" alt="cerveau">
<figcaption class="elementor-image-carousel-caption">cerveau</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/cropped-Science-300x300.jpg" alt="mpo">
<figcaption class="elementor-image-carousel-caption">cropped-Science.jpg</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/ordi-300x169.jpg" alt="pôo">
<figcaption class="elementor-image-carousel-caption">ordi</figcaption>
</figure>
</div>
<div class="slick-slide">
<figure class="slick-slide-inner">
<img class="slick-slide-image" src="http://parnasse.ovh/wp-content/uploads/2015/12/astro-300x188.jpg" alt="captiopn 1">
<figcaption class="elementor-image-carousel-caption">astro</figcaption>
</figure>
</div>
</div>
'background-image'は' img'タグよりも柔軟性の高い方法です。 – Adam
@Adam確かに、良い先生。 –