在我的代碼下面,我想div類card-columns
內聯/毗鄰類card-custom
的div。試圖對齊旁邊的兩個div並失敗
我想我正在嘗試很容易,但我無法找到正確的組合顯示和浮動來得到它的工作。
我試圖使父div的柔性與display: flex
希望它只是工作。但是,儘管它使得它混亂了第一個div的大小。
有人可以幫告訴我,我做錯了什麼嗎?
我有一個codepen例如這裏http://codepen.io/anon/pen/grxRza
.maxWidth {
width: 100%;
max-width: 1370px;
margin: 60px auto;
padding: 0 20px;
}
.card-columns {
column-count: 5;
}
.intermission {
color: blue;
column-span: all;
border: 2px solid;
}
.card-custom {
border: 1px solid blue;
width: 430px;
height: 220px;
}
<!-- intermission column span full -->
<div class="intermission">
<div class="card-custom">
</div>
<div class="card-columns">
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
</div><!-- end intermission card-columns -->
</div><!-- end intermission div-->
您是否嘗試過使用樣式=「顯示:inline-塊;」爲你的div? – Gaetan
類似[this](http://codepen.io/anon/pen/ZOJyVj)? – Huelfe
看看這裏提供的示例:https://css-tricks.com/snippets/css/a-guide-to-flexbox/ – GOB