我試圖構建佈局以實現具有響應式佈局中的許多卡的CSS:大型顯示器(col l3),兩個中型(col m6)和一個in小(col s12)。實現CSS:響應式地堆疊卡
不幸的是我不能管理他們到無間隙垂直堆疊,即使它們的寬度是相同的:https://jsfiddle.net/wdvq57rp/
感謝您的幫助!
HTML:
<div class="container">
<h1>Stacked-Cards Test</h1>
<div class="row card-container">
<!-- Test Cards -->
<div class="col l3 m6 s12">
<div class="card-panel grey lighten-4">
<h5>Title</h5>
<p>Description</p>
<div>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
</div>
</div>
</div>
<div class="col l3 m6 s12">
<div class="card-panel grey lighten-4">
<h5>Title</h5>
<p>Description</p>
<div>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
</div>
</div>
</div>
<div class="col l3 m6 s12">
<div class="card-panel grey lighten-4">
<h5>Title</h5>
<p>Description</p>
<div>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
</div>
</div>
</div>
<div class="col l3 m6 s12">
<div class="card-panel grey lighten-4">
<h5>Title</h5>
<p>Description</p>
<div>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
</div>
</div>
</div>
<div class="col l3 m6 s12">
<div class="card-panel grey lighten-4">
<h5>Title</h5>
<p>Description</p>
<div>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
</div>
</div>
</div>
<div class="col l3 m6 s12">
<div class="card-panel grey lighten-4">
<h5>Title</h5>
<p>Description</p>
<div>
<p><a href="#" class="pink-text text-accent2">Link!</a></p>
</div>
</div>
</div>
</div> <!-- Row Container with Cards END-->
</div> <!-- Main Container END-->
<!-- JS Imports -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.99.0/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<script src="./js/magic.js"></script>
CSS:
.card-panel {
margin: 10px;
padding: 10px;
}
.container {
margin: 0;
max-width: 100%;
width: 100%;
}
你在找這個嗎? https://jsfiddle.net/wdvq57rp/1/ –
這就近了!在第二塊瓷磚的第二排中,仍然存在缺口。我期望在所有垂直和水平卡片之間具有相同的利潤/差距。 – Juri
比你必須使所有col同樣高度或使用CSS砌體佈局技巧http://w3bits.com/demo/css-masonry/ –