I am generating a "table"
using bootstrap cards, fetching data via $smarty
.
I would like to collapse the the table into 2 columns when the viewport
gets small.
So that the header will be on the left, with attributes like: name, date, age. And the corresponding column on the right has the data in line, like: Fred, 12.12.2012, 41.
Tried using the built in responsive feature in bootstrap cards, however when the viewport
gets small, everything collapses into 1 column. With the header on top.
I have tried jquery.basictable.min.js
but it would not work.
Simple graphic of desired result:
name | stewie
date | 124214
age | 9000
name | bob
date | 45845
age | 65
<div class="container-fluid">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-4">
<span class="font-medium-3">name</span>
</div>
<div class="col-4">
<span class="font-medium-3">date</span>
</div>
<div class="col-4">
<span class="font-medium-3">age</span>
</div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-4">
<span class="font-medium-3">stewie</span>
</div>
<div class="col-4">
<span class="font-medium-3">124214</span>
</div>
<div class="col-4">
<span class="font-medium-3">9000</span>
</div>
</div>
<div class="row">
<div class="col-4">
<span class="font-medium-3">bob</span>
</div>
<div class="col-4">
<span class="font-medium-3">45845</span>
</div>
<div class="col-4">
<span class="font-medium-3">65</span>
</div>
</div>
</div>
</div>
</div>
I'll provide a link here to show what I would like to achieve: http://www.jerrylow.com/basictable/demo/
I assume that CSS could do a lot of what I need, but I am unable to find relevant information.