"Responsive Data Tables"
Bootstrap 3.3.0 Snippet by AlexSemenov

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<label><a href="https://css-tricks.com/responsive-data-tables/">Link</a></label>
<h2>Responsive Data Tables</h2>
<table class="table-vertical">
<thead>
<tr>
<th>Title1</th>
<th>Title2</th>
<th>Title3</th>
<th>Title4</th>
<th>Title5</th>
<th>Title6</th>
<th>Title7</th>
<th>Title8</th>
<th>Title9</th>
<th>Title10</th>
</tr>
</thead>
<tbody>
<tr>
<td data-th="Title1">Value 1-1</td>
<td data-th="Title2">Value 1-2</td>
<td data-th="Title3">Value 1-3</td>
<td data-th="Title4">Value 1-4</td>
<td data-th="Title5">Value 1-5</td>
<td data-th="Title6">Value 1-6</td>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Generic Styling, for Desktops/Laptops
*/
.table-vertical {
width: 100%;
height:auto;
border-collapse: collapse;
}
/* Zebra striping */
.table-vertical>tbody>tr:nth-of-type(odd) {
background: #f9f9f9;
}
.table-vertical>thead>tr>th {
background: #fff;
color: #000;
font-weight: bold;
}
.table-vertical>tbody>tr>td, .table-vertical>thead>tr>th {
padding: 6px;
border-top: 1px solid #ddd;
text-align: left;
vertical-align: middle;
}
/*
Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px
and also iPads specifically.
*/
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: