【问题标题】:div with image gallery will not align center带有图片库的 div 不会对齐中心
【发布时间】:2013-06-12 21:23:35
【问题描述】:

我有一个作品集,是我在很多人和教程的帮助下自己建立的。我注意到实际的画廊(目前有 8 个拇指)不会居中。尤其是当缩放到移动尺寸时,它看起来有点歪。

我将画廊包装在一个名为“imagewrapper”的 div 中,并为其赋予了这些属性;

.imagewrapper{
    width: 80%;
    margin: 0 auto;
    height:100%;
}

宽度是否与我的 div 对齐方式混淆?完整的代码在这里; http://kellyvuijst.nl。如果你能把我送到正确的方向,那就太好了。

【问题讨论】:

    标签: css html alignment


    【解决方案1】:

    我只想对您的 css 进行一些更改:

    .imagewrapper{
        width: 80%;
        margin: 0 auto;
        height:100%;
        text-align: center; /* add this */
    }
    
    .mask {
        position:relative;
        height:180px;
        width:240px;
        box-shadow:0 0 1px #000;
        border:5px solid #f6f6f6;
        overflow:hidden;
        float:left; /* delete this */
        margin:15px;
        display: inline-block; /* add this */
    }
    

    【讨论】:

    • 正是我要说的。
    • 你是我的英雄;)谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-21
    • 2019-03-25
    • 2016-09-13
    • 2023-04-04
    • 2015-07-17
    • 1970-01-01
    • 2012-09-02
    相关资源
    最近更新 更多