0

我对 css 布局有一点问题

所以我想对齐一些 div 内联并将它们向上移动 3 个像素(以使外观完美)

它在 IE10/11 中运行良好,但在 FireFox 和 chrome 中运行良好。

我不能给你链接,但我可以插入一些屏幕

所以这就是我想要的(在 IE10/11 上工作)

http://beehiver.jurion.me/ie11.png

现在火狐:

http://beehiver.jurion.me/firefox.png 这是我这部分的 CSS:

#buttons {
    display: inline-block;
    color: #526271;
}

    #buttons a {
        color: #526271;
        transition: all 250ms ease-out;
    }


        #buttons a:hover {
            color: #1ab9d6;
        }

    #buttons div {
        display: inline-block;
        width: 100px;
        height: 53px;
        border-left: 1px solid grey;
        vertical-align: top;
        transform: translate(0px,-2px);
        padding-left: 3px;
        text-align: center;
        transition: all 250ms ease-out;
        border-bottom: 2px solid transparent;
    }

        #buttons div:hover {
            border-left-color: #1ab9d6;
            border-bottom-color: #1ab9d6;
        }

        #buttons div i {
            font-size: 34px;
            vertical-align: top;
            transform: translate(0px,10px);
            display: block;
            margin-left: auto;
            margin-right: auto;
        }

我只是找不到为什么它不起作用:(

编辑 :

J McFee 的回答:

inline-block 对空格很敏感,我建议浮动你的 div。

工作正常 !(产生一个我可以解决的小问题,与问题无关)

变化 :

#buttons div {
    float:left;

<div class="clearfix"></div>
4

1 回答 1

0

假设“#buttons div”在“#buttons”内,请尝试更改:

#buttons {
    display: inline-block;
    color: #526271;
}

#buttons {
    display: block;
    color: #526271;
    height:53px;
}
于 2013-10-18T05:28:24.567 回答