I'm looking for a way to display 4 cards with variable heights in a responsive manner on Angular 1.
On big screens it should show something like this:
+-------+ +-------+
| 1 | | 2 |
| | | |
+-------+ | |
| 3 | | |
| | +-------+
| | | 4 |
| | | |
+-------+ | |
| |
+-------+
On small screens should display like this:
+-------+
| 1 |
| |
+-------+
| 2 |
| |
| |
| |
+-------+
| 3 |
| |
| |
| |
+-------+
| 4 |
| |
| |
| |
+-------+
This works ok for the responsive requirement, but shows big spaces between cards on the same column if another card is higher
<div class="container" layout="row" layout-align="space-between" layout-wrap>
<md-card class="details" id="d1" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
<md-card class="details" id="d2" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
<md-card class="details" id="d3" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
<md-card class="details" id="d4" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
</div>
This works ok for the variable height requirement, but is not responsive (note that the order of the cards needs to be different here):
<div class="container" layout="col">
<md-card class="details" id="d1" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
<md-card class="details" id="d3" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
</div
<div class="container" layout="col">
<md-card class="details" id="d2" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
<md-card class="details" id="d4" flex="auto" flex-sm="100" flex-xs="100">...</md-card>
</div>