鍍金池/ 問答/HTML/ 為什么second_1_2,與second_1_1這兩個div不在一條水平線上?

為什么second_1_2,與second_1_1這兩個div不在一條水平線上?

second_1_2為什么會靠下一點?

<div class="second_1">
            <div class="second_1_1">
                <img alt="" src="/ehouse/img/item/industry/left.png">
            </div>
            <div class="second_1_2">
            的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字右側(cè)的文字
            </div>
            
        </div>

.second_1{
    height: 250px;
}
.second_1 div {
    display: inline-block;
}
.second_1_1 img {
    width: 250px;
    height:250px;
    margin: 0px 100px;
}
.second_1_2{
    width:500px;
    height:250px;
    text-align: left;
}

圖片描述
圖片描述

回答
編輯回答
青瓷

因為你用了 display: inline-block; 給second_1_1加上vertical-align: top和second_1_2加上vertical-align: top

2017年8月21日 15:56
編輯回答
醉淸風

將.second_1里加上display:flex;然后把子div的display:inline-block去掉
倆個inline-block擠在一起總會有各種各樣的問題,flex大法好

2017年2月20日 02:11
編輯回答
笨小蛋

應該是你body或者父元素樣式的問題導致, line-height 什么鬼?

2017年8月6日 11:48
編輯回答
兔囡囡

second_1_2加上vertical-align: top;

2018年2月1日 05:50
編輯回答
初念

行內(nèi)元素默認基于基線對齊的方式導致的,解決方法同上面改變兩個元素的對齊方式vertical-align: top!

2017年6月13日 13:02