table.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. ---
  2. title: Table
  3. layout: documentation
  4. doc-tab: elements
  5. doc-subtab: table
  6. ---
  7. {% capture table_example %}
  8. <table class="table">
  9. <thead>
  10. <tr>
  11. <th><abbr title="Position">Pos</abbr></th>
  12. <th>Team</th>
  13. <th><abbr title="Played">Pld</abbr></th>
  14. <th><abbr title="Won">W</abbr></th>
  15. <th><abbr title="Drawn">D</abbr></th>
  16. <th><abbr title="Lost">L</abbr></th>
  17. <th><abbr title="Goals for">GF</abbr></th>
  18. <th><abbr title="Goals against">GA</abbr></th>
  19. <th><abbr title="Goal difference">GD</abbr></th>
  20. <th><abbr title="Points">Pts</abbr></th>
  21. <th>Qualification or relegation</th>
  22. </tr>
  23. </thead>
  24. <tfoot>
  25. <tr>
  26. <th><abbr title="Position">Pos</abbr></th>
  27. <th>Team</th>
  28. <th><abbr title="Played">Pld</abbr></th>
  29. <th><abbr title="Won">W</abbr></th>
  30. <th><abbr title="Drawn">D</abbr></th>
  31. <th><abbr title="Lost">L</abbr></th>
  32. <th><abbr title="Goals for">GF</abbr></th>
  33. <th><abbr title="Goals against">GA</abbr></th>
  34. <th><abbr title="Goal difference">GD</abbr></th>
  35. <th><abbr title="Points">Pts</abbr></th>
  36. <th>Qualification or relegation</th>
  37. </tr>
  38. </tfoot>
  39. <tbody>
  40. <tr>
  41. <th>1</th>
  42. <td><a href="https://en.wikipedia.org/wiki/Leicester_City_F.C." title="Leicester City F.C.">Leicester City</a> <strong>(C)</strong>
  43. </td>
  44. <td>38</td>
  45. <td>23</td>
  46. <td>12</td>
  47. <td>3</td>
  48. <td>68</td>
  49. <td>36</td>
  50. <td>+32</td>
  51. <td>81</td>
  52. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Champions_League#Group_stage" title="2016–17 UEFA Champions League">Champions League group stage</a></td>
  53. </tr>
  54. <tr>
  55. <th>2</th>
  56. <td><a href="https://en.wikipedia.org/wiki/Arsenal_F.C." title="Arsenal F.C.">Arsenal</a></td>
  57. <td>38</td>
  58. <td>20</td>
  59. <td>11</td>
  60. <td>7</td>
  61. <td>65</td>
  62. <td>36</td>
  63. <td>+29</td>
  64. <td>71</td>
  65. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Champions_League#Group_stage" title="2016–17 UEFA Champions League">Champions League group stage</a></td>
  66. </tr>
  67. <tr>
  68. <th>3</th>
  69. <td><a href="https://en.wikipedia.org/wiki/Tottenham_Hotspur_F.C." title="Tottenham Hotspur F.C.">Tottenham Hotspur</a></td>
  70. <td>38</td>
  71. <td>19</td>
  72. <td>13</td>
  73. <td>6</td>
  74. <td>69</td>
  75. <td>35</td>
  76. <td>+34</td>
  77. <td>70</td>
  78. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Champions_League#Group_stage" title="2016–17 UEFA Champions League">Champions League group stage</a></td>
  79. </tr>
  80. <tr class="is-selected">
  81. <th>4</th>
  82. <td><a href="https://en.wikipedia.org/wiki/Manchester_City_F.C." title="Manchester City F.C.">Manchester City</a></td>
  83. <td>38</td>
  84. <td>19</td>
  85. <td>9</td>
  86. <td>10</td>
  87. <td>71</td>
  88. <td>41</td>
  89. <td>+30</td>
  90. <td>66</td>
  91. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Champions_League#Play-off_round" title="2016–17 UEFA Champions League">Champions League play-off round</a></td>
  92. </tr>
  93. <tr>
  94. <th>5</th>
  95. <td><a href="https://en.wikipedia.org/wiki/Manchester_United_F.C." title="Manchester United F.C.">Manchester United</a></td>
  96. <td>38</td>
  97. <td>19</td>
  98. <td>9</td>
  99. <td>10</td>
  100. <td>49</td>
  101. <td>35</td>
  102. <td>+14</td>
  103. <td>66</td>
  104. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Europa_League#Group_stage" title="2016–17 UEFA Europa League">Europa League group stage</a></td>
  105. </tr>
  106. <tr>
  107. <th>6</th>
  108. <td><a href="https://en.wikipedia.org/wiki/Southampton_F.C." title="Southampton F.C.">Southampton</a></td>
  109. <td>38</td>
  110. <td>18</td>
  111. <td>9</td>
  112. <td>11</td>
  113. <td>59</td>
  114. <td>41</td>
  115. <td>+18</td>
  116. <td>63</td>
  117. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Europa_League#Group_stage" title="2016–17 UEFA Europa League">Europa League group stage</a></td>
  118. </tr>
  119. <tr>
  120. <th>7</th>
  121. <td><a href="https://en.wikipedia.org/wiki/West_Ham_United_F.C." title="West Ham United F.C.">West Ham United</a></td>
  122. <td>38</td>
  123. <td>16</td>
  124. <td>14</td>
  125. <td>8</td>
  126. <td>65</td>
  127. <td>51</td>
  128. <td>+14</td>
  129. <td>62</td>
  130. <td>Qualification for the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_UEFA_Europa_League#Third_qualifying_round" title="2016–17 UEFA Europa League">Europa League third qualifying round</a></td>
  131. </tr>
  132. <tr>
  133. <th>8</th>
  134. <td><a href="https://en.wikipedia.org/wiki/Liverpool_F.C." title="Liverpool F.C.">Liverpool</a></td>
  135. <td>38</td>
  136. <td>16</td>
  137. <td>12</td>
  138. <td>10</td>
  139. <td>63</td>
  140. <td>50</td>
  141. <td>+13</td>
  142. <td>60</td>
  143. <td></td>
  144. </tr>
  145. <tr>
  146. <th>9</th>
  147. <td><a href="https://en.wikipedia.org/wiki/Stoke_City_F.C." title="Stoke City F.C.">Stoke City</a></td>
  148. <td>38</td>
  149. <td>14</td>
  150. <td>9</td>
  151. <td>15</td>
  152. <td>41</td>
  153. <td>55</td>
  154. <td>−14</td>
  155. <td>51</td>
  156. <td></td>
  157. </tr>
  158. <tr>
  159. <th>10</th>
  160. <td><a href="https://en.wikipedia.org/wiki/Chelsea_F.C." title="Chelsea F.C.">Chelsea</a></td>
  161. <td>38</td>
  162. <td>12</td>
  163. <td>14</td>
  164. <td>12</td>
  165. <td>59</td>
  166. <td>53</td>
  167. <td>+6</td>
  168. <td>50</td>
  169. <td></td>
  170. </tr>
  171. <tr>
  172. <th>11</th>
  173. <td><a href="https://en.wikipedia.org/wiki/Everton_F.C." title="Everton F.C.">Everton</a></td>
  174. <td>38</td>
  175. <td>11</td>
  176. <td>14</td>
  177. <td>13</td>
  178. <td>59</td>
  179. <td>55</td>
  180. <td>+4</td>
  181. <td>47</td>
  182. <td></td>
  183. </tr>
  184. <tr>
  185. <th>12</th>
  186. <td><a href="https://en.wikipedia.org/wiki/Swansea_City_A.F.C." title="Swansea City A.F.C.">Swansea City</a></td>
  187. <td>38</td>
  188. <td>12</td>
  189. <td>11</td>
  190. <td>15</td>
  191. <td>42</td>
  192. <td>52</td>
  193. <td>−10</td>
  194. <td>47</td>
  195. <td></td>
  196. </tr>
  197. <tr>
  198. <th>13</th>
  199. <td><a href="https://en.wikipedia.org/wiki/Watford_F.C." title="Watford F.C.">Watford</a></td>
  200. <td>38</td>
  201. <td>12</td>
  202. <td>9</td>
  203. <td>17</td>
  204. <td>40</td>
  205. <td>50</td>
  206. <td>−10</td>
  207. <td>45</td>
  208. <td></td>
  209. </tr>
  210. <tr>
  211. <th>14</th>
  212. <td><a href="https://en.wikipedia.org/wiki/West_Bromwich_Albion_F.C." title="West Bromwich Albion F.C.">West Bromwich Albion</a></td>
  213. <td>38</td>
  214. <td>10</td>
  215. <td>13</td>
  216. <td>15</td>
  217. <td>34</td>
  218. <td>48</td>
  219. <td>−14</td>
  220. <td>43</td>
  221. <td></td>
  222. </tr>
  223. <tr>
  224. <th>15</th>
  225. <td><a href="https://en.wikipedia.org/wiki/Crystal_Palace_F.C." title="Crystal Palace F.C.">Crystal Palace</a></td>
  226. <td>38</td>
  227. <td>11</td>
  228. <td>9</td>
  229. <td>18</td>
  230. <td>39</td>
  231. <td>51</td>
  232. <td>−12</td>
  233. <td>42</td>
  234. <td></td>
  235. </tr>
  236. <tr>
  237. <th>16</th>
  238. <td><a href="https://en.wikipedia.org/wiki/A.F.C._Bournemouth" title="A.F.C. Bournemouth">AFC Bournemouth</a></td>
  239. <td>38</td>
  240. <td>11</td>
  241. <td>9</td>
  242. <td>18</td>
  243. <td>45</td>
  244. <td>67</td>
  245. <td>−22</td>
  246. <td>42</td>
  247. <td></td>
  248. </tr>
  249. <tr>
  250. <th>17</th>
  251. <td><a href="https://en.wikipedia.org/wiki/Sunderland_A.F.C." title="Sunderland A.F.C.">Sunderland</a></td>
  252. <td>38</td>
  253. <td>9</td>
  254. <td>12</td>
  255. <td>17</td>
  256. <td>48</td>
  257. <td>62</td>
  258. <td>−14</td>
  259. <td>39</td>
  260. <td></td>
  261. </tr>
  262. <tr>
  263. <th>18</th>
  264. <td><a href="https://en.wikipedia.org/wiki/Newcastle_United_F.C." title="Newcastle United F.C.">Newcastle United</a> <strong>(R)</strong>
  265. </td>
  266. <td>38</td>
  267. <td>9</td>
  268. <td>10</td>
  269. <td>19</td>
  270. <td>44</td>
  271. <td>65</td>
  272. <td>−21</td>
  273. <td>37</td>
  274. <td>Relegation to the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_Football_League_Championship" title="2016–17 Football League Championship">Football League Championship</a></td>
  275. </tr>
  276. <tr>
  277. <th>19</th>
  278. <td><a href="https://en.wikipedia.org/wiki/Norwich_City_F.C." title="Norwich City F.C.">Norwich City</a> <strong>(R)</strong>
  279. </td>
  280. <td>38</td>
  281. <td>9</td>
  282. <td>7</td>
  283. <td>22</td>
  284. <td>39</td>
  285. <td>67</td>
  286. <td>−28</td>
  287. <td>34</td>
  288. <td>Relegation to the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_Football_League_Championship" title="2016–17 Football League Championship">Football League Championship</a></td> </tr>
  289. <tr>
  290. <th>20</th>
  291. <td><a href="https://en.wikipedia.org/wiki/Aston_Villa_F.C." title="Aston Villa F.C.">Aston Villa</a> <strong>(R)</strong>
  292. </td>
  293. <td>38</td>
  294. <td>3</td>
  295. <td>8</td>
  296. <td>27</td>
  297. <td>27</td>
  298. <td>76</td>
  299. <td>−49</td>
  300. <td>17</td>
  301. <td>Relegation to the <a href="https://en.wikipedia.org/wiki/2016%E2%80%9317_Football_League_Championship" title="2016–17 Football League Championship">Football League Championship</a></td>
  302. </tr>
  303. </tbody>
  304. </table>
  305. {% endcapture %}
  306. {% include subnav-elements.html %}
  307. <section class="section">
  308. <div class="container">
  309. <h1 class="title">Tables</h1>
  310. <h2 class="subtitle">The inevitable HTML <strong>table</strong>, with special case cells</h2>
  311. {%
  312. include meta.html
  313. colors=false
  314. sizes=false
  315. variables=true
  316. %}
  317. <hr>
  318. <div class="content">
  319. <p>You simply need to attach a single <code>.table</code> CSS class on a <code>&lt;table&gt;</code> with the following structure:</p>
  320. <ul>
  321. <li>
  322. <code>table</code> the main <strong>container</strong>
  323. <ul>
  324. <li>
  325. <code>thead</code> the optional <strong>top</strong> part of the table
  326. </li>
  327. <li>
  328. <code>tfoot</code> the optional <strong>bottom</strong> part of the table
  329. </li>
  330. <li>
  331. <code>tbody</code> the main <strong>content</strong> of the table
  332. <ul>
  333. <li>
  334. <code>tr</code> each table <strong>row</strong>
  335. <ul>
  336. <li>
  337. <code>th</code> a table cell <strong>heading</strong>
  338. </li>
  339. <li>
  340. <code>td</code> a table <strong>cell</strong>
  341. </li>
  342. </ul>
  343. </li>
  344. </ul>
  345. </li>
  346. </ul>
  347. </li>
  348. </ul>
  349. <p>
  350. You can set a table row as <strong>selected</strong> by appending the <code>is-selected</code> modifier on a <code>&lt;tr&gt;</code>
  351. </p>
  352. </div>
  353. {% include snippet.html content=table_example horizontal=true more=true %}
  354. {% include anchor.html name="Modifiers" %}
  355. <div class="columns">
  356. <div class="column">
  357. <p>Add <strong>borders</strong> to all the cells.</p>
  358. </div>
  359. <div class="column">
  360. <code>table is-bordered</code>
  361. </div>
  362. <div class="column is-half">
  363. <table class="table is-bordered">
  364. <thead>
  365. <tr>
  366. <th>One</th>
  367. <th>Two</th>
  368. </tr>
  369. </thead>
  370. <tbody>
  371. <tr>
  372. <td>Three</td>
  373. <td>Four</td>
  374. </tr>
  375. </tbody>
  376. </table>
  377. </div>
  378. </div>
  379. <div class="columns">
  380. <div class="column">
  381. <p>Add <strong>stripes</strong> to the table.</p>
  382. </div>
  383. <div class="column">
  384. <code>table is-striped</code>
  385. </div>
  386. <div class="column is-half">
  387. <table class="table is-striped">
  388. <thead>
  389. <tr>
  390. <th>One</th>
  391. <th>Two</th>
  392. </tr>
  393. </thead>
  394. <tbody>
  395. <tr>
  396. <td>Three</td>
  397. <td>Four</td>
  398. </tr>
  399. <tr>
  400. <td>Five</td>
  401. <td>Six</td>
  402. </tr>
  403. <tr>
  404. <td>Seven</td>
  405. <td>Eight</td>
  406. </tr>
  407. <tr>
  408. <td>Nine</td>
  409. <td>Ten</td>
  410. </tr>
  411. <tr>
  412. <td>Eleven</td>
  413. <td>Twelve</td>
  414. </tr>
  415. </tbody>
  416. </table>
  417. </div>
  418. </div>
  419. <div class="columns">
  420. <div class="column">
  421. <p>Make the cells <strong>narrower</strong>.</p>
  422. </div>
  423. <div class="column">
  424. <code>table is-narrow</code>
  425. </div>
  426. <div class="column is-half">
  427. <table class="table is-narrow">
  428. <thead>
  429. <tr>
  430. <th>One</th>
  431. <th>Two</th>
  432. </tr>
  433. </thead>
  434. <tbody>
  435. <tr>
  436. <td>Three</td>
  437. <td>Four</td>
  438. </tr>
  439. <tr>
  440. <td>Five</td>
  441. <td>Six</td>
  442. </tr>
  443. <tr>
  444. <td>Seven</td>
  445. <td>Eight</td>
  446. </tr>
  447. <tr>
  448. <td>Nine</td>
  449. <td>Ten</td>
  450. </tr>
  451. <tr>
  452. <td>Eleven</td>
  453. <td>Twelve</td>
  454. </tr>
  455. </tbody>
  456. </table>
  457. </div>
  458. </div>
  459. {% include elements/new-tag.html version="0.5.4" %}
  460. <div class="columns">
  461. <div class="column">
  462. <p>You can add a <strong>hover effect</strong> on each row</p>
  463. </div>
  464. <div class="column">
  465. <code>table is-hoverable</code>
  466. </div>
  467. <div class="column is-half">
  468. <table class="table is-hoverable">
  469. <thead>
  470. <tr>
  471. <th>One</th>
  472. <th>Two</th>
  473. </tr>
  474. </thead>
  475. <tbody>
  476. <tr>
  477. <td>Three</td>
  478. <td>Four</td>
  479. </tr>
  480. <tr>
  481. <td>Five</td>
  482. <td>Six</td>
  483. </tr>
  484. <tr>
  485. <td>Seven</td>
  486. <td>Eight</td>
  487. </tr>
  488. <tr>
  489. <td>Nine</td>
  490. <td>Ten</td>
  491. </tr>
  492. <tr>
  493. <td>Eleven</td>
  494. <td>Twelve</td>
  495. </tr>
  496. </tbody>
  497. </table>
  498. </div>
  499. </div>
  500. <div class="columns">
  501. <div class="column">
  502. <p>You can have a <strong>fullwidth</strong> table.</p>
  503. </div>
  504. <div class="column">
  505. <code>table is-fullwidth</code>
  506. </div>
  507. <div class="column is-half">
  508. <table class="table is-fullwidth">
  509. <thead>
  510. <tr>
  511. <th>One</th>
  512. <th>Two</th>
  513. </tr>
  514. </thead>
  515. <tbody>
  516. <tr>
  517. <td>Three</td>
  518. <td>Four</td>
  519. </tr>
  520. <tr>
  521. <td>Five</td>
  522. <td>Six</td>
  523. </tr>
  524. <tr>
  525. <td>Seven</td>
  526. <td>Eight</td>
  527. </tr>
  528. <tr>
  529. <td>Nine</td>
  530. <td>Ten</td>
  531. </tr>
  532. <tr>
  533. <td>Eleven</td>
  534. <td>Twelve</td>
  535. </tr>
  536. </tbody>
  537. </table>
  538. </div>
  539. </div>
  540. <div class="columns">
  541. <div class="column">
  542. <p>You can <strong>combine</strong> all four modifiers.</p>
  543. </div>
  544. <div class="column">
  545. <code>table is-bordered is-striped is-narrow is-fullwidth</code>
  546. </div>
  547. <div class="column is-half">
  548. <table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
  549. <thead>
  550. <tr>
  551. <th>One</th>
  552. <th>Two</th>
  553. </tr>
  554. </thead>
  555. <tbody>
  556. <tr>
  557. <td>Three</td>
  558. <td>Four</td>
  559. </tr>
  560. <tr>
  561. <td>Five</td>
  562. <td>Six</td>
  563. </tr>
  564. <tr>
  565. <td>Seven</td>
  566. <td>Eight</td>
  567. </tr>
  568. <tr>
  569. <td>Nine</td>
  570. <td>Ten</td>
  571. </tr>
  572. <tr>
  573. <td>Eleven</td>
  574. <td>Twelve</td>
  575. </tr>
  576. </tbody>
  577. </table>
  578. </div>
  579. </div>
  580. {% include variables.html type='element' %}
  581. </div>
  582. </section>