index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <!DOCTYPE html>
  2. <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
  3. <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
  4. <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
  5. <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
  6. <!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
  7. <head>
  8. <meta charset="utf-8" />
  9. <!-- Set the viewport width to device width for mobile -->
  10. <meta name="viewport" content="width=device-width" />
  11. <title>Responsive Tables by ZURB</title>
  12. <!-- Included CSS Files -->
  13. <!-- Combine and Compress These CSS Files -->
  14. <link rel="stylesheet" href="stylesheets/globals.css">
  15. <link rel="stylesheet" href="stylesheets/typography.css">
  16. <link rel="stylesheet" href="stylesheets/grid.css">
  17. <link rel="stylesheet" href="stylesheets/ui.css">
  18. <link rel="stylesheet" href="stylesheets/forms.css">
  19. <link rel="stylesheet" href="stylesheets/orbit.css">
  20. <link rel="stylesheet" href="stylesheets/reveal.css">
  21. <link rel="stylesheet" href="stylesheets/mobile.css">
  22. <!-- End Combine and Compress These CSS Files -->
  23. <link rel="stylesheet" href="stylesheets/app.css">
  24. <link rel="stylesheet" href="responsive-tables.css">
  25. <script src="javascripts/jquery.min.js"></script>
  26. <script src="responsive-tables.js"></script>
  27. <!--[if lt IE 9]>
  28. <link rel="stylesheet" href="stylesheets/ie.css">
  29. <![endif]-->
  30. <!-- IE Fix for HTML5 Tags -->
  31. <!--[if lt IE 9]>
  32. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  33. <![endif]-->
  34. </head>
  35. <body>
  36. <!-- container -->
  37. <div class="container">
  38. <div class="row">
  39. <div class="twelve columns">
  40. <h1>Responsive Tables</h1>
  41. <h4 class="subhead">A CSS/JS solution for tables that allows them to shrink on small devices without sacrificing the value of tables, comparison of columns.</h4>
  42. <p>Our solution for responsive tables requires two included files (both linked on this page): responsive-tables.css and responsive-tables.js.</p>
  43. <p>The JS will help us create some new elements on small devices, so we don't have to modify our table markup on the page. The CSS applies the requisite positioning and overflow styles to make the new elements work.</p>
  44. <pre>
  45. /* Attach the Table CSS and Javascript */
  46. <span style="color: #6ab825; font-weight: normal">&lt;link</span> <span style="color: #bbbbbb">rel=</span><span style="color: #ed9d13">"stylesheet"</span> <span style="color: #bbbbbb">href=</span><span style="color: #ed9d13">"responsive-tables.css"</span><span style="color: #6ab825; font-weight: normal">&gt;</span>
  47. <span style="color: #6ab825; font-weight: normal">&lt;script</span> <span style="color: #bbbbbb">src=</span><span style="color: #ed9d13">"stylesheet"</span> <span style="color: #bbbbbb">href=</span><span style="color: #ed9d13">"responsive-tables.js"</span><span style="color: #6ab825; font-weight: normal">&gt;</span><span style="color: #6ab825; font-weight: normal">&lt;/script&gt;</span></pre>
  48. <hr />
  49. <h5>Small Word Table</h5>
  50. <table class="responsive">
  51. <tr>
  52. <th>Header 1</th>
  53. <th>Header 2</th>
  54. <th>Header 3</th>
  55. <th>Header 4</th>
  56. <th>Header 5</th>
  57. <th>Header 6</th>
  58. <th>Header 7</th>
  59. <th>Header 8</th>
  60. </tr>
  61. <tr>
  62. <td>row 1, cell 1</td>
  63. <td>row 1, cell 2</td>
  64. <td>row 1, cell 3</td>
  65. <td>row 1, cell 4</td>
  66. <td>row 1, cell 5</td>
  67. <td>row 1, cell 6</td>
  68. <td>row 1, cell 7</td>
  69. <td>row 1, cell 8</td>
  70. </tr>
  71. <tr>
  72. <td>row 2, cell 1</td>
  73. <td>row 2, cell 2</td>
  74. <td>row 2, cell 3</td>
  75. <td>row 2, cell 4</td>
  76. <td>row 2, cell 5</td>
  77. <td>row 2, cell 6</td>
  78. <td>row 2, cell 7</td>
  79. <td>row 2, cell 8</td>
  80. </tr>
  81. <tr>
  82. <td>row 3, cell 1</td>
  83. <td>row 3, cell 2</td>
  84. <td>row 3, cell 3</td>
  85. <td>row 3, cell 4</td>
  86. <td>row 3, cell 5</td>
  87. <td>row 3, cell 6</td>
  88. <td>row 3, cell 7</td>
  89. <td>row 3, cell 8</td>
  90. </tr>
  91. <tr>
  92. <td>row 4, cell 1</td>
  93. <td>row 4, cell 2</td>
  94. <td>row 4, cell 3</td>
  95. <td>row 4, cell 4</td>
  96. <td>row 4, cell 5</td>
  97. <td>row 4, cell 6</td>
  98. <td>row 4, cell 7</td>
  99. <td>row 4, cell 8</td>
  100. </tr>
  101. </table>
  102. <div class="row">
  103. <div class="six columns">
  104. <p>In most cases, tables like this are okay at smaller sizes (since they'll break on every small word). However, with this many columns a very small device like a phone would still be a problem.</p>
  105. </div>
  106. <div class="six columns">
  107. <p>By attaching a class of <strong>.responsive</strong> to the table, our JS/CSS will kick in.</p>
  108. </div>
  109. </div>
  110. <pre>
  111. /* Put the responsive class on the table */
  112. <span style="color: #6ab825; font-weight: normal">&lt;table</span> <span style="color: #bbbbbb">class=</span><span style="color: #ed9d13">"responsive"</span><span style="color: #6ab825; font-weight: normal">&gt;</span>
  113. <span style="color: #6ab825; font-weight: normal">&lt;tr&gt;</span> …
  114. </pre>
  115. <hr />
  116. <h5>Larger Content Table</h5>
  117. <table class="responsive">
  118. <tbody>
  119. <tr>
  120. <th>Perk</th>
  121. <th>Description</th>
  122. <th>ID</th>
  123. <th>Skill Req</th>
  124. <th>Perk Req</th>
  125. </tr>
  126. <tr>
  127. <td>Steel Smithing</td>
  128. <td>Can create Steel armor and weapons at forges, and improve them twice as much.</td>
  129. <td>000cb40d</td>
  130. <td></td>
  131. <td></td>
  132. </tr>
  133. <tr>
  134. <td>Arcane Blacksmith</td>
  135. <td>You can improve magical weapons and armor.</td>
  136. <td><span style="font-size: x-small" class="idref">0005218e</span></td>
  137. <td>60 Smithing</td>
  138. <td>Steel Smithing</td>
  139. </tr>
  140. <tr>
  141. <td>Dwarven Smithing</td>
  142. <td>Can create Dwarven armor and weapons at forges, and improve them twice as much.</td>
  143. <td>000cb40e</td>
  144. <td>30 Smithing</td>
  145. <td>Steel Smithing</td>
  146. </tr>
  147. <tr>
  148. <td>Orcish Smithing</td>
  149. <td>Can create Orcish armor and weapons at forges, and improve them twice as much.</td>
  150. <td>000cb410</td>
  151. <td>50 Smithing</td>
  152. <td>Dwarven Smithing</td>
  153. </tr>
  154. <tr>
  155. <td>Ebony Smithing</td>
  156. <td>Can create Ebony armor and weapons at forges</a>, and improve them twice as much.</td>
  157. <td>000cb412</td>
  158. <td>80 Smithing</td>
  159. <td>Orcish Smithing</td>
  160. </tr>
  161. <tr>
  162. <td>Daedric Smithing</td>
  163. <td>Can create Daedric armor and weapons at forges, and improve them twice as much.</td>
  164. <td>000cb413</span></td>
  165. <td>90 Smithing</td>
  166. <td>Ebony Smithing</td>
  167. </tr>
  168. <tr>
  169. <td>Elven Smithing</td>
  170. <td>Can create Elven armor and weapons at forges, and improve them twice as much.</td>
  171. <td>000cb40f</td>
  172. <td>30 Smithing</td>
  173. <td>Steel Smithing</td>
  174. </tr>
  175. <tr>
  176. <td>Advanced Armors</td>
  177. <td>Can create Scaled and Plate armor at forges, and improve them twice as much.
  178. <td>000cb414</td>
  179. <td>50 Smithing</td>
  180. <td>Elven Smithing</td>
  181. </tr>
  182. <tr>
  183. <td>Glass Smithing</td>
  184. <td>Can create Glass armor and weapons at forges, and improve them twice as much.</td>
  185. <td>000cb411</td>
  186. <td>70 Smithing</td>
  187. <td>Advanced Armors</td>
  188. </tr>
  189. <tr>
  190. <td>Dragon Armor</td>
  191. <td>Can create Dragon armor at forges, and improve them twice as much.</td>
  192. <td>00052190</td>
  193. <td>100 Smithing</td>
  194. <td>Daedric Smithing or Glass Smithing</td>
  195. </tr>
  196. </tbody>
  197. </table>
  198. <div class="row">
  199. <div class="six columns">
  200. <p>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).</p>
  201. </div>
  202. <div class="six columns">
  203. <p>Notice on a small device how we maintain the left column when it has so much content.</p>
  204. </div>
  205. </div>
  206. <hr />
  207. <h5>Very Long 1st Cell Content</h5>
  208. <table class="responsive">
  209. <tr>
  210. <th>Header 1</th>
  211. <th>Header 2</th>
  212. <th>Header 3</th>
  213. <th>Header 4</th>
  214. <th>Header 5</th>
  215. <th>Header 6</th>
  216. <th>Header 7</th>
  217. <th>Header 8</th>
  218. </tr>
  219. <tr>
  220. <td>Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage.</td>
  221. <td>row 1, cell 2</td>
  222. <td>row 1, cell 3</td>
  223. <td>row 1, cell 4</td>
  224. <td>row 1, cell 5</td>
  225. <td>row 1, cell 6</td>
  226. <td>row 1, cell 7</td>
  227. <td>row 1, cell 8</td>
  228. </tr>
  229. <tr>
  230. <td>Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage.</td>
  231. <td>row 2, cell 2</td>
  232. <td>row 2, cell 3</td>
  233. <td>row 2, cell 4</td>
  234. <td>row 2, cell 5</td>
  235. <td>row 2, cell 6</td>
  236. <td>row 2, cell 7</td>
  237. <td>row 2, cell 8</td>
  238. </tr>
  239. <tr>
  240. <td>Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage.</td>
  241. <td>row 3, cell 2</td>
  242. <td>row 3, cell 3</td>
  243. <td>row 3, cell 4</td>
  244. <td>row 3, cell 5</td>
  245. <td>row 3, cell 6</td>
  246. <td>row 3, cell 7</td>
  247. <td>row 3, cell 8</td>
  248. </tr>
  249. <tr>
  250. <td>Ham pork leberkas bresaola, brisket t-bone filet mignon hamburger salami andouille short loin sausage.</td>
  251. <td>row 4, cell 2</td>
  252. <td>row 4, cell 3</td>
  253. <td>row 4, cell 4</td>
  254. <td>row 4, cell 5</td>
  255. <td>row 4, cell 6</td>
  256. <td>row 4, cell 7</td>
  257. <td>row 4, cell 8</td>
  258. </tr>
  259. </table>
  260. <div class="row">
  261. <div class="six columns">
  262. <p>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.</p>
  263. </div>
  264. <div class="six columns">
  265. <p>We do this so we can correctly predict the height of the cells for both the pinned columns and the rest of the columns.</p>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </body>
  271. </html>