如何将图像置于滑块博客中心

时间:2016-09-10 17:31:40

标签: javascript html css slider

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

表示与滑块相关的所有编码:

 /* ===[ 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;
}

1 个答案:

答案 0 :(得分:1)

将此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;
}