CSS图像库不会居中 [英] CSS Image Gallery will not center

查看:66
本文介绍了CSS图像库不会居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    .imgContain{
    width: 100%;
    margin: 0 auto;
    position: relative;
    text-align: center;
}

.imgContain img{
    width: 250px;
    height: 250px;
    float: left;
}

.imgContain img:hover{
    opacity: 0.60;
}

由于某种原因,这将不在我的页面上居中。任何帮助表示赞赏。

For some reason, this will not center on my page. Any help is appreciated.

推荐答案

很难理解您真正想发生的事情,但这是使用 inline-block的另一种方法- http://jsfiddle.net/sheriffderek/29jvS/

Hard to understand what you really want to happen, but here is another way using inline-block - http://jsfiddle.net/sheriffderek/29jvS/

<div class="imgContain">
    <img src="http://placehold.it/400x400" alt="" />
    <img src="http://placehold.it/400x400" alt="" />
</div>


.imgContain{
    text-align: center;
}

.imgContain img {
    display: inline-block;
    width: 250px;
    height: 250px;
}

这篇关于CSS图像库不会居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆