我的CSS按钮不在div的底部垂直对齐,我得到了以下代码:

<div id="spacebuttons" align="right" style="height: 150px; width:920px; background-color:#6F0; display: inline-block; float:left; vertical-align:bottom">
    <a href="http://www.domain.com/cspace/customerspace.php">
    <img src="images/FontAwesome_f007(0)_32.png" alt="customer space" width="32" height="32" border="0" />
    <button type="button" class="btn btn-default btn-sm" onClick="window.location.href('http://www.domain.com/cspace/customerspace.php')">Customer  Space</button>
    </a>


我究竟做错了什么?

最佳答案

试试看,我为您添加了一些样式,但我不知道您的确切输出



#spacebuttons {
    height: 150px;
    width:96%;
    padding: 2%;
    background-color: #6F0;
    float:left;
}
#spacebuttons a {
    line-height: 32px;
    float: right;
    display: block;
}
#spacebuttons a img {
    float: left;
    margin-right: 5px;
}

<div id="spacebuttons">
    <a href="http://www.domain.com/cspace/customerspace.php">
    <img src="images/FontAwesome_f007(0)_32.png" alt="" width="32" height="32" border="0" />
    <button type="button" class="btn btn-default btn-sm" onClick="window.location.href('http://www.domain.com/cspace/customerspace.php')">Customer  Space</button>
    </a>
</div>

关于html - div中的CSS垂直对齐按钮不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30214675/

10-11 06:08