内联块的两个div不起作用

时间:2014-09-19 14:25:58

标签: css

为什么这两个DIV不显示内联?任何事情发生,第二个DIV显示底部...

#mac{
display: inline-block;
background-color:#000000;
    background-repeat: no-repeat;
padding-top:130px;
height:455px;
width:50%;
}
#mac2{

display: inline-block;
background-color:#000000;
    background-repeat: no-repeat;
padding-top:130px;
height:455px;
width:50%;
}
<!doctype html>
<html>
    <head></head>
    <body>
        <div id="mac"></div><div id="mac2"><img src="images/rocket.png"><span class="textomedio">Maximizamos tu ROI</span></div>
    </body>
</html>

http://jsfiddle.net/XCDsu/4/

1 个答案:

答案 0 :(得分:0)

您需要将vertical-align:top;添加到#mac2

&#13;
&#13;
#mac{
display: inline-block;
background-color:#000000;
background-repeat: no-repeat;
padding-top:130px;
height:455px;
width:50%;
}
#mac2{
display: inline-block;
background-color:#000000;
background-repeat: no-repeat;
padding-top:130px;
height:455px;
width:50%;
vertical-align:top;
}
&#13;
<!doctype html>
<html>
    <head></head>
    <body>
        <div id="mac"></div><div id="mac2"><img src="images/rocket.png"><span class="textomedio">Maximizamos tu ROI</span></div>
    </body>
</html>
&#13;
&#13;
&#13;