2017-05-12 67 views
-2

我有一個大<div>與3個較小的<div>裏面。 我想把3個小<div>之間的空間沒有定義的大<div>的大小或把margin-top到每個小<div>如何把div之間的空間放在更大的div中?

這裏是我的CSS:

table 
{ 
    border-radius: 10px; 
    border-collapse: collapse; 
    background: white; 
} 
.div_tableaux 
{ 
    border: 10px solid red; 
    display: flex; 
    justify-content: space-arround; 
    align-items: center; 
    flex-direction: column; 
    margin-top: 10%; 
    padding: 30px; 
} 

你知道該怎麼做,在CSS?

Red = Big div;藍色=小格

+0

一些代碼將有助於 – Edwin

+0

我不能告訴你任何事情,因爲它的私人信息和它的結果很重要。您可能需要顯示一個圖像 – TheTinyCat

+2

[MVCE](https://stackoverflow.com/help/mcve) – dippas

回答

0

你可以把另一個股利,並設置高度它們之間的對他們說:

.red { 
 
    width: 300px; 
 
    border: 3px solid red; 
 
    padding: 20px; 
 
} 
 

 
.blue { 
 
    width: 90%; 
 
    border: 3px solid blue; 
 
} 
 

 
.empty { 
 
    width: 100%; 
 
    border: 0; 
 
    height: 20px; 
 
}
<div class="red"> 
 
    <div class="blue"> 
 
     content 
 
    </div> 
 
    <div class="empty"> 
 
    </div> 
 
    <div class="blue"> 
 
     content 
 
    </div> 
 
    <div class="empty"> 
 
    </div> 
 
    <div class="blue"> 
 
     content 
 
    </div> 
 
</div>

+0

這也不是一個壞主意。我認爲沒有CSS屬性。 – TheTinyCat

1

嘗試使用Flex:

.father { 
 
    display: flex; 
 
    justify-content: space-around; 
 
    background: #333; 
 
    padding: 5% 0; 
 
} 
 

 
.child { 
 
    width: 25%; 
 
    height: 200px; 
 
    background: #ff6600; 
 
}
<div class="father"> 
 

 
    <div class="child"></div> 
 
    <div class="child"></div> 
 
    <div class="child"></div> 
 

 
</div>

+0

Thats particulary我不想做的事:/ sry – TheTinyCat

+0

但是謝謝tou! – TheTinyCat

+0

@TheTinyCat,你不想做什麼? – Alexander