2016-04-28 50 views
0

爲什麼在兩個div之間並排放置兩個div,爲什麼這麼難?divs排列在一起,空間爲

我已經試過

<div style="height: 160px; width: 100%; box-sizing:border-box; display:table;"> 

      <div class="introwrapper" style="height:100%; width:25%;display:table-cell;background: pink;box-sizing: border-box;">First  Div</div> 
<div style="width:5%;"> 
</div> 
      <div class="introwrapper" style="height:100%; width:25%;display:table-cell; background: blue; box-sizing: border-box;">second div</div> 

     </div> 

但我不能得到之間的空間。 它已經遍佈SO和其他博客,但都沒有正確的解決方案。

+0

使用浮動:留在格樣式並排排列的一面; – techspider

+0

我終於結束了表和tr和tds。 Div並不總是很容易。我正在努力在div上顯示徑向測量儀,所以調整空間非常困難 –

+0

但是如果我找到一些很好的解決方案,我會喜歡回覆到div –

回答

1

您可能需要使用float:left並排對準兩個div側

<div style="height: 160px; width: 100%; box-sizing:border-box; display:table;"> 
    <div class="introwrapper" style="float:left;margin-right:30px; height:100%; width:25%;display:table-cell;background: pink;box-sizing: border-box;">First  Div</div> 
    <div class="introwrapper" style="float:left;height:100%; width:25%;display:table-cell; background: blue; box-sizing: border-box;">second div</div> 
    <br style="clear:left" /> 
</div> 
+0

謝謝techspider –