html - 如何垂直对齐这两个 div?

标签 html css vertical-alignment

this jsFiddle , 如何垂直对齐图像和文本?

HTML:

<div class="step_div">
    <div class="step_div_inner">
        <div class="step_div_inner_image">
            <img src="http://i.imgur.com/TasZn.png">
        </div>
        <div class="step_div_inner_text">
            here is some text here is some text here is some text here is some text here is some text here is some text 
        </div>
    </div>
</div>​

CSS

.step_div_inner_text {
    font-size:18px;
    width:460px;
    line-height:24px;
    position:relative;
    left:5px;
    bottom:14px;
    display:inline-block;
}
.step_div_inner_image {
    display:inline-block;
}
.step_div {
    padding:20px 0;
}
.step_div_inner {
    width:574px;
    margin:0 auto;
}​

最佳答案

你可以像这样使用 float :

http://jsfiddle.net/xH2da/10/

您只需确保在需要时清除它们。

关于html - 如何垂直对齐这两个 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11835732/

相关文章:

html - 覆盖父标签中的 CSS 继承

html - 如何将这些按钮排成一行?

css - Bootstrap header 中的垂直对齐

javascript - 使用条件设置下一个标签/类的样式

html - 如何将 Internet Explorer 中的数据 URI 用作 URL?

具有固定标题和固定前导列的 HTML 表格,在标题和第一列中带有 knockout 控件

html - 在最小高度 div 内垂直对齐单行文本

javascript - 创建一个在悬停时显示详细信息的 map

html - 延伸到页面高度的::after 和::before 伪元素的背景图像

html - 创建响应式菜单不起作用