我有一個外部flexbox
與兩個內部divs
彼此相鄰,都爲150x150
大小。填充是10px
。我使用flex-wrap: wrap;
,這樣如果窗口不適合他們兩個,第二個去低於第一個。CSS Flexbox空間與包裝之間divs
<!DOCTYPE html>
<html>
<head>
<style>
.big {
background-color: red;
display: flex;
padding: 10px;
flex-wrap: wrap;
}
.small1 {
background-color: yellow;
width: 150px;
height: 150px;
}
.small2 {
background-color: blue;
width: 150px;
height: 150px;
}
</style>
</head>
<body>
<div class="big">
<div class="small1">Test1</div>
<div class="small2">Test2</div>
</div>
</body>
</html>
我怎樣才能添加其他10 pixels space
他們兩人之間,即使一個旁邊或下面?我試圖在內部div的幾個變化與margin-left
和margin-top
但都沒有給我的結果,因爲一個可以水平工作,但不會垂直...
Horizontaly垂直,10px當黃色div結束,並開始藍色。 –