table.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. ---
  2. layout: documentation
  3. doc-tab: elements
  4. doc-subtab: table
  5. ---
  6. {% include subnav-elements.html %}
  7. <section class="section">
  8. <div class="container">
  9. <h1 class="title">Tables</h1>
  10. <h2 class="subtitle">The inevitable HTML <strong>table</strong>, with special case cells</h2>
  11. <hr>
  12. {% capture table_example %}
  13. <table class="table">
  14. <thead>
  15. <tr>
  16. <th><abbr title="Position">Pos</abbr></th>
  17. <th>Team</th>
  18. <th><abbr title="Played">Pld</abbr></th>
  19. <th><abbr title="Won">W</abbr></th>
  20. <th><abbr title="Drawn">D</abbr></th>
  21. <th><abbr title="Lost">L</abbr></th>
  22. <th><abbr title="Goals for">GF</abbr></th>
  23. <th><abbr title="Goals against">GA</abbr></th>
  24. <th><abbr title="Goal difference">GD</abbr></th>
  25. <th><abbr title="Points">Pts</abbr></th>
  26. <th>Qualification or relegation</th>
  27. </tr>
  28. </thead>
  29. <tfoot>
  30. <tr>
  31. <th><abbr title="Position">Pos</abbr></th>
  32. <th>Team</th>
  33. <th><abbr title="Played">Pld</abbr></th>
  34. <th><abbr title="Won">W</abbr></th>
  35. <th><abbr title="Drawn">D</abbr></th>
  36. <th><abbr title="Lost">L</abbr></th>
  37. <th><abbr title="Goals for">GF</abbr></th>
  38. <th><abbr title="Goals against">GA</abbr></th>
  39. <th><abbr title="Goal difference">GD</abbr></th>
  40. <th><abbr title="Points">Pts</abbr></th>
  41. <th>Qualification or relegation</th>
  42. </tr>
  43. </tfoot>
  44. <tbody>
  45. <tr>
  46. <th>1</th>
  47. <td><a href="https://en.wikipedia.org/wiki/Leicester_City_F.C." title="Leicester City F.C.">Leicester City</a> <strong>(C)</strong>
  48. </td>
  49. <td>38</td>
  50. <td>23</td>
  51. <td>12</td>
  52. <td>3</td>
  53. <td>68</td>
  54. <td>36</td>
  55. <td>+32</td>
  56. <td>81</td>
  57. <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>
  58. </tr>
  59. <tr>
  60. <th>2</th>
  61. <td><a href="https://en.wikipedia.org/wiki/Arsenal_F.C." title="Arsenal F.C.">Arsenal</a></td>
  62. <td>38</td>
  63. <td>20</td>
  64. <td>11</td>
  65. <td>7</td>
  66. <td>65</td>
  67. <td>36</td>
  68. <td>+29</td>
  69. <td>71</td>
  70. <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>
  71. </tr>
  72. <tr>
  73. <th>3</th>
  74. <td><a href="https://en.wikipedia.org/wiki/Tottenham_Hotspur_F.C." title="Tottenham Hotspur F.C.">Tottenham Hotspur</a></td>
  75. <td>38</td>
  76. <td>19</td>
  77. <td>13</td>
  78. <td>6</td>
  79. <td>69</td>
  80. <td>35</td>
  81. <td>+34</td>
  82. <td>70</td>
  83. <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>
  84. </tr>
  85. <tr>
  86. <th>4</th>
  87. <td><a href="https://en.wikipedia.org/wiki/Manchester_City_F.C." title="Manchester City F.C.">Manchester City</a></td>
  88. <td>38</td>
  89. <td>19</td>
  90. <td>9</td>
  91. <td>10</td>
  92. <td>71</td>
  93. <td>41</td>
  94. <td>+30</td>
  95. <td>66</td>
  96. <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>
  97. </tr>
  98. <tr>
  99. <th>5</th>
  100. <td><a href="https://en.wikipedia.org/wiki/Manchester_United_F.C." title="Manchester United F.C.">Manchester United</a></td>
  101. <td>38</td>
  102. <td>19</td>
  103. <td>9</td>
  104. <td>10</td>
  105. <td>49</td>
  106. <td>35</td>
  107. <td>+14</td>
  108. <td>66</td>
  109. <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>
  110. </tr>
  111. <tr>
  112. <th>6</th>
  113. <td><a href="https://en.wikipedia.org/wiki/Southampton_F.C." title="Southampton F.C.">Southampton</a></td>
  114. <td>38</td>
  115. <td>18</td>
  116. <td>9</td>
  117. <td>11</td>
  118. <td>59</td>
  119. <td>41</td>
  120. <td>+18</td>
  121. <td>63</td>
  122. <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>
  123. </tr>
  124. <tr>
  125. <th>7</th>
  126. <td><a href="https://en.wikipedia.org/wiki/West_Ham_United_F.C." title="West Ham United F.C.">West Ham United</a></td>
  127. <td>38</td>
  128. <td>16</td>
  129. <td>14</td>
  130. <td>8</td>
  131. <td>65</td>
  132. <td>51</td>
  133. <td>+14</td>
  134. <td>62</td>
  135. <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>
  136. </tr>
  137. <tr>
  138. <th>8</th>
  139. <td><a href="https://en.wikipedia.org/wiki/Liverpool_F.C." title="Liverpool F.C.">Liverpool</a></td>
  140. <td>38</td>
  141. <td>16</td>
  142. <td>12</td>
  143. <td>10</td>
  144. <td>63</td>
  145. <td>50</td>
  146. <td>+13</td>
  147. <td>60</td>
  148. <td></td>
  149. </tr>
  150. <tr>
  151. <th>9</th>
  152. <td><a href="https://en.wikipedia.org/wiki/Stoke_City_F.C." title="Stoke City F.C.">Stoke City</a></td>
  153. <td>38</td>
  154. <td>14</td>
  155. <td>9</td>
  156. <td>15</td>
  157. <td>41</td>
  158. <td>55</td>
  159. <td>−14</td>
  160. <td>51</td>
  161. <td></td>
  162. </tr>
  163. <tr>
  164. <th>10</th>
  165. <td><a href="https://en.wikipedia.org/wiki/Chelsea_F.C." title="Chelsea F.C.">Chelsea</a></td>
  166. <td>38</td>
  167. <td>12</td>
  168. <td>14</td>
  169. <td>12</td>
  170. <td>59</td>
  171. <td>53</td>
  172. <td>+6</td>
  173. <td>50</td>
  174. <td></td>
  175. </tr>
  176. <tr>
  177. <th>11</th>
  178. <td><a href="https://en.wikipedia.org/wiki/Everton_F.C." title="Everton F.C.">Everton</a></td>
  179. <td>38</td>
  180. <td>11</td>
  181. <td>14</td>
  182. <td>13</td>
  183. <td>59</td>
  184. <td>55</td>
  185. <td>+4</td>
  186. <td>47</td>
  187. <td></td>
  188. </tr>
  189. <tr>
  190. <th>12</th>
  191. <td><a href="https://en.wikipedia.org/wiki/Swansea_City_A.F.C." title="Swansea City A.F.C.">Swansea City</a></td>
  192. <td>38</td>
  193. <td>12</td>
  194. <td>11</td>
  195. <td>15</td>
  196. <td>42</td>
  197. <td>52</td>
  198. <td>−10</td>
  199. <td>47</td>
  200. <td></td>
  201. </tr>
  202. <tr>
  203. <th>13</th>
  204. <td><a href="https://en.wikipedia.org/wiki/Watford_F.C." title="Watford F.C.">Watford</a></td>
  205. <td>38</td>
  206. <td>12</td>
  207. <td>9</td>
  208. <td>17</td>
  209. <td>40</td>
  210. <td>50</td>
  211. <td>−10</td>
  212. <td>45</td>
  213. <td></td>
  214. </tr>
  215. <tr>
  216. <th>14</th>
  217. <td><a href="https://en.wikipedia.org/wiki/West_Bromwich_Albion_F.C." title="West Bromwich Albion F.C.">West Bromwich Albion</a></td>
  218. <td>38</td>
  219. <td>10</td>
  220. <td>13</td>
  221. <td>15</td>
  222. <td>34</td>
  223. <td>48</td>
  224. <td>−14</td>
  225. <td>43</td>
  226. <td></td>
  227. </tr>
  228. <tr>
  229. <th>15</th>
  230. <td><a href="https://en.wikipedia.org/wiki/Crystal_Palace_F.C." title="Crystal Palace F.C.">Crystal Palace</a></td>
  231. <td>38</td>
  232. <td>11</td>
  233. <td>9</td>
  234. <td>18</td>
  235. <td>39</td>
  236. <td>51</td>
  237. <td>−12</td>
  238. <td>42</td>
  239. <td></td>
  240. </tr>
  241. <tr>
  242. <th>16</th>
  243. <td><a href="https://en.wikipedia.org/wiki/A.F.C._Bournemouth" title="A.F.C. Bournemouth">AFC Bournemouth</a></td>
  244. <td>38</td>
  245. <td>11</td>
  246. <td>9</td>
  247. <td>18</td>
  248. <td>45</td>
  249. <td>67</td>
  250. <td>−22</td>
  251. <td>42</td>
  252. <td></td>
  253. </tr>
  254. <tr>
  255. <th>17</th>
  256. <td><a href="https://en.wikipedia.org/wiki/Sunderland_A.F.C." title="Sunderland A.F.C.">Sunderland</a></td>
  257. <td>38</td>
  258. <td>9</td>
  259. <td>12</td>
  260. <td>17</td>
  261. <td>48</td>
  262. <td>62</td>
  263. <td>−14</td>
  264. <td>39</td>
  265. <td></td>
  266. </tr>
  267. <tr>
  268. <th>18</th>
  269. <td><a href="https://en.wikipedia.org/wiki/Newcastle_United_F.C." title="Newcastle United F.C.">Newcastle United</a> <strong>(R)</strong>
  270. </td>
  271. <td>38</td>
  272. <td>9</td>
  273. <td>10</td>
  274. <td>19</td>
  275. <td>44</td>
  276. <td>65</td>
  277. <td>−21</td>
  278. <td>37</td>
  279. <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>
  280. </tr>
  281. <tr>
  282. <th>19</th>
  283. <td><a href="https://en.wikipedia.org/wiki/Norwich_City_F.C." title="Norwich City F.C.">Norwich City</a> <strong>(R)</strong>
  284. </td>
  285. <td>38</td>
  286. <td>9</td>
  287. <td>7</td>
  288. <td>22</td>
  289. <td>39</td>
  290. <td>67</td>
  291. <td>−28</td>
  292. <td>34</td>
  293. <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>
  294. <tr>
  295. <th>20</th>
  296. <td><a href="https://en.wikipedia.org/wiki/Aston_Villa_F.C." title="Aston Villa F.C.">Aston Villa</a> <strong>(R)</strong>
  297. </td>
  298. <td>38</td>
  299. <td>3</td>
  300. <td>8</td>
  301. <td>27</td>
  302. <td>27</td>
  303. <td>76</td>
  304. <td>−49</td>
  305. <td>17</td>
  306. <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>
  307. </tr>
  308. </tbody>
  309. </table>
  310. {% endcapture %}
  311. <div class="example">
  312. {{table_example}}
  313. </div>
  314. {% highlight html %}
  315. {{table_example}}
  316. {% endhighlight %}
  317. <hr>
  318. <h3 class="title">Modifiers</h3>
  319. <div class="columns">
  320. <div class="column">
  321. <p>Add <strong>borders</strong> to all the cells.</p>
  322. </div>
  323. <div class="column">
  324. <code>table is-bordered</code>
  325. </div>
  326. <div class="column is-half">
  327. <table class="table is-bordered">
  328. <thead>
  329. <tr>
  330. <th>One</th>
  331. <th>Two</th>
  332. </tr>
  333. </thead>
  334. <tbody>
  335. <tr>
  336. <td>Three</td>
  337. <td>Four</td>
  338. </tr>
  339. </tbody>
  340. </table>
  341. </div>
  342. </div>
  343. <div class="columns">
  344. <div class="column">
  345. <p>Add <strong>stripes</strong> to the table.</p>
  346. </div>
  347. <div class="column">
  348. <code>table is-striped</code>
  349. </div>
  350. <div class="column is-half">
  351. <table class="table is-striped">
  352. <thead>
  353. <tr>
  354. <th>One</th>
  355. <th>Two</th>
  356. </tr>
  357. </thead>
  358. <tbody>
  359. <tr>
  360. <td>Three</td>
  361. <td>Four</td>
  362. </tr>
  363. <tr>
  364. <td>Five</td>
  365. <td>Six</td>
  366. </tr>
  367. <tr>
  368. <td>Seven</td>
  369. <td>Eight</td>
  370. </tr>
  371. <tr>
  372. <td>Nine</td>
  373. <td>Ten</td>
  374. </tr>
  375. <tr>
  376. <td>Eleven</td>
  377. <td>Twelve</td>
  378. </tr>
  379. </tbody>
  380. </table>
  381. </div>
  382. </div>
  383. <div class="columns">
  384. <div class="column">
  385. <p>Make the cells <strong>narrower</strong>.</p>
  386. </div>
  387. <div class="column">
  388. <code>table is-narrow</code>
  389. </div>
  390. <div class="column is-half">
  391. <table class="table is-narrow">
  392. <thead>
  393. <tr>
  394. <th>One</th>
  395. <th>Two</th>
  396. </tr>
  397. </thead>
  398. <tbody>
  399. <tr>
  400. <td>Three</td>
  401. <td>Four</td>
  402. </tr>
  403. <tr>
  404. <td>Five</td>
  405. <td>Six</td>
  406. </tr>
  407. <tr>
  408. <td>Seven</td>
  409. <td>Eight</td>
  410. </tr>
  411. <tr>
  412. <td>Nine</td>
  413. <td>Ten</td>
  414. </tr>
  415. <tr>
  416. <td>Eleven</td>
  417. <td>Twelve</td>
  418. </tr>
  419. </tbody>
  420. </table>
  421. </div>
  422. </div>
  423. <div class="columns">
  424. <div class="column">
  425. <p>You can <strong>combine</strong> all three modifiers.</p>
  426. </div>
  427. <div class="column">
  428. <code>table is-bordered is-striped is-narrow</code>
  429. </div>
  430. <div class="column is-half">
  431. <table class="table is-bordered is-striped is-narrow">
  432. <thead>
  433. <tr>
  434. <th>One</th>
  435. <th>Two</th>
  436. </tr>
  437. </thead>
  438. <tbody>
  439. <tr>
  440. <td>Three</td>
  441. <td>Four</td>
  442. </tr>
  443. <tr>
  444. <td>Five</td>
  445. <td>Six</td>
  446. </tr>
  447. <tr>
  448. <td>Seven</td>
  449. <td>Eight</td>
  450. </tr>
  451. <tr>
  452. <td>Nine</td>
  453. <td>Ten</td>
  454. </tr>
  455. <tr>
  456. <td>Eleven</td>
  457. <td>Twelve</td>
  458. </tr>
  459. </tbody>
  460. </table>
  461. </div>
  462. </div>
  463. </div>
  464. </section>