Responsive Tables

A CSS/JS solution for tables that allows them to shrink on small devices without sacrificing the value of tables, comparison of columns.

Our solution for responsive tables requires two included files (both linked on this page): responsive-tables.css and responsive-tables.js.

The JS will enable us to make some new components on little gadgets, so we don't need to change our table markup on the page. The CSS applies the imperative situating and flood styles to influence the new components to work.

/* Attach the Table CSS and Javascript */
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://www.owaisbikiya.com/stackui.blogspot/Downloads/ResponsiveTable/css/responsive-tables.css">
<script src="stylesheet" href="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="stylesheet" href="http://www.owaisbikiya.com/stackui.blogspot/Downloads/ResponsiveTable/js/responsive-tables.js"></script>

Small Word Table
Header 1 Header 2 Header 3 Header 4 Header 5 Header 6 Header 7 Header 8
row 1, cell 1 row 1, cell 2 row 1, cell 3 row 1, cell 4 row 1, cell 5 row 1, cell 6 row 1, cell 7 row 1, cell 8
row 2, cell 1 row 2, cell 2 row 2, cell 3 row 2, cell 4 row 2, cell 5 row 2, cell 6 row 2, cell 7 row 2, cell 8
row 3, cell 1 row 3, cell 2 row 3, cell 3 row 3, cell 4 row 3, cell 5 row 3, cell 6 row 3, cell 7 row 3, cell 8
row 4, cell 1 row 4, cell 2 row 4, cell 3 row 4, cell 4 row 4, cell 5 row 4, cell 6 row 4, cell 7 row 4, cell 8

Much of the time, tables like this are alright at littler sizes (since they'll break on each little word). In any case, with this numerous sections a little gadget like a telephone would in any case be an issue.

By attaching a class of .responsive to the table, our JS/CSS will kick in.

					/* Put the responsive class on the table */
					<table class="responsive">
				  <tr> …
				

Larger Content Table
Perk Description ID Skill Req Perk Req
Steel Smithing Can create Steel armor and weapons at forges, and improve them twice as much. 000cb40d
Arcane Blacksmith You can improve magical weapons and armor. 0005218e 60 Smithing Steel Smithing
Dwarven Smithing Can create Dwarven armor and weapons at forges, and improve them twice as much. 000cb40e 30 Smithing Steel Smithing
Orcish Smithing Can create Orcish armor and weapons at forges, and improve them twice as much. 000cb410 50 Smithing Dwarven Smithing
Ebony Smithing Can create Ebony armor and weapons at forges, and improve them twice as much. 000cb412 80 Smithing Orcish Smithing
Daedric Smithing Can create Daedric armor and weapons at forges, and improve them twice as much. 000cb413 90 Smithing Ebony Smithing
Elven Smithing Can create Elven armor and weapons at forges, and improve them twice as much. 000cb40f 30 Smithing Steel Smithing
Advanced Armors Can create Scaled and Plate armor at forges, and improve them twice as much. 000cb414 50 Smithing Elven Smithing
Glass Smithing Can create Glass armor and weapons at forges, and improve them twice as much. 000cb411 70 Smithing Advanced Armors
Dragon Armor Can create Dragon armor at forges, and improve them twice as much. 00052190 100 Smithing Daedric Smithing or Glass Smithing

The effect is even more pronounced on a table like this one, where we detail how to craft different armor types in Skyrim (we're nerds, okay).

Notice on a small device how we maintain the left column when it has so much content.


Very Long 1st Cell Content
Header 1 Header 2 Header 3 Header 4 Header 5 Header 6 Header 7 Header 8
Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage. row 1, cell 2 row 1, cell 3 row 1, cell 4 row 1, cell 5 row 1, cell 6 row 1, cell 7 row 1, cell 8
Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage. row 2, cell 2 row 2, cell 3 row 2, cell 4 row 2, cell 5 row 2, cell 6 row 2, cell 7 row 2, cell 8
Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage. row 3, cell 2 row 3, cell 3 row 3, cell 4 row 3, cell 5 row 3, cell 6 row 3, cell 7 row 3, cell 8
Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage. row 4, cell 2 row 4, cell 3 row 4, cell 4 row 4, cell 5 row 4, cell 6 row 4, cell 7 row 4, cell 8

Finally, in this example you'll see how this works for very long first-cell content. Both the first cell and the remaining cells are independently scrollable on small devices.

We do this so we can correctly predict the height of the cells for both the pinned columns and the rest of the columns.


Tabular Content Table
Recorded Title Clip Length
23rd-Jul-2017 Surah Fatiha 47′ 29″
30-Jul-2017 Session 2 47′ 29″
06-Aug-2017 Session 3 47′ 29″

By attaching a class of .tabular to the table, our JS/CSS will kick in.

/* Put the responsive class on the table */
<table class="tabular">
<thead> 
	<tr>
		<th> 
		</th> 
	</tr>
</thead> 
<tbody> 
<tr>
		<td> 
		</td> 
	</tr>
</tbody> 
</table>