gpt4 book ai didi

javascript - 如何在 slider 博主中居中图像

转载 作者:太空宇宙 更新时间:2023-11-04 09:46:48 25 4
gpt4 key购买 nike

我博客中的帖子有一个 slider ,可以显示帖子中的所有图片。所有的图片都向左对齐,我不知道如何解决这个问题。我希望它们与中心对齐,但不确定如何有效地做到这一点。这是我的网站: http://reezyblog.blogspot.co.uk/

这里是与 slider 相关的所有编码:

 /* ===[ Slider ]=== */
.homepage-slider {
opacity: 0;
margin-bottom: 60px;
}
.homepage-slider .slick-slide .featured-title {
text-align: center;
position: absolute;
margin: 0 auto;
top: 20%;
left: 30%;
width: 40%;
padding: 40px 30px 50px;
background: #fff;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
.homepage-slider .slick-slide:hover .featured-title { background: rgba(255,255,255,.9) }
.homepage-slider .slick-slide .featured-title h2 {
font-family: 'Playfair Display', Georgia, 'Times New Roman', Times, serif;
font-size: 24px;
line-height: 1.2;
margin-bottom: 10px;
color: #111;
}
.homepage-slider .slick-slide .featured-title .featured-date {
color: #999;
font-size: 13px;
}
.homepage-slider .slick-slide .featured-title .featured-category {
display: inline-block;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
color: #e1534f;
margin-bottom: 10px;
border-radius: 3px;
}

最佳答案

将此 text-align: center 添加到 .slick-initialized .slick-slide 类,如下所示

.slick-initialized .slick-slide {
display: block;
text-align: center;
}

并使您的 .slick-slide {display: inline-block;} 如下所示

.slick-slide img {
display: inline-block;
}

关于javascript - 如何在 slider 博主中居中图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39428769/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com