对齐块元素的顶部

时间:2012-11-10 17:06:30

标签: css html5

我的HTML5 / CSS呈现方式如下:http://imgur.com/0rixh

使用以下代码:

                <li>
                    <div class="name">Booger Jet.zip</div>
                    <progress max="100" value="60"></progress>
                    <div class="control"></div>
                    <div class="status">12 MB / 21 MB   240 kB/s</status>
                </li>

#uploads li progress {
    width: 317px;
    margin-bottom: 4px;
}

#uploads li .control {
    width: 14px;
    height: 14px;
    display: inline-block;
    opacity: 0.6;
    background-image: url('../img/stop_button.png');
}

如何垂直对齐它们?我有什么选择?谢谢!

2 个答案:

答案 0 :(得分:1)

试试吧

#uploads li progress {
    width: 317px;
    margin-bottom: 4px;
    margin-top:1px; /* change it if you need more top sapce*/
}
#uploads li .control {
        width: 14px;
        height: 14px;
        display: inline-block;
        vertical-align:top;
        opacity: 0.6;
        background-image: url('../img/stop_button.png');
    }

答案 1 :(得分:0)

您可以使用 vertical-align:middle

#uploads li .control, #uploads li progress{
 display:inline-block;
 vertical-align:middle;
}