const slides = [
{
eachSlide: "url(https://www.consilium.europa.eu/media/54319/erasmus.png)",
},
{
eachSlide: "url(https://unsplash.it/1900/1024/?image=291)",
},
{
eachSlide: "url(https://unsplash.it/1900/1024/?image=786)",
},
{
eachSlide: "url(https://unsplash.it/1900/1024/?image=768)",
},
{
eachSlide: "url(https://unsplash.it/1900/1024/?image=726)",
},
{
eachSlide: "url(https://unsplash.it/1900/1024/?image=821)",
},
];
.slider {
width: 85vw;
height: 65vh;
overflow: hidden;
position: relative;
margin-top: 2%;
margin-left: 5%;
}
.slider .each-slide {
width: 100vw;
height: 100vh;
image-rendering: auto;
float: left;
line-height: 100vh;
font-size: 40vh;
text-align: center;
background-size: cover;
background-position: center center;
background-color: transparent;
}
当需要更改宽度和高度时,滑块功能被破坏。我添加的其他图像不适合此范围。它看起来像是半适合。如何为我添加的其他图像给予宽度和高度?
1条答案
按热度按时间eoxn13cs1#
如果你想轻松创建滑块,你可以使用slick.js库slickJs