123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- ---
- layout: documentation
- doc-tab: elements
- doc-subtab: table
- ---
- {% include subnav-elements.html %}
- <section class="section">
- <div class="container">
- <h1 class="title">Tables</h1>
- <h2 class="subtitle">The inevitable HTML <strong>table</strong>, with special case cells</h2>
- <hr>
- <div class="content">
- <p>You simply need to attach a single <code>.table</code> CSS class on a <code><table></code> with the following structure:</p>
- <ul>
- <li>
- <code>table</code>
- <ul>
- <li>
- <code>thead</code>
- </li>
- <li>
- <code>tfoot</code>
- </li>
- <li>
- <code>tbody</code>
- <ul>
- <li>
- <code>tr</code>
- <ul>
- <li>
- <code>th</code>
- </li>
- <li>
- <code>td</code>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- <p>
- <span class="tag is-success">New!</span>
- <span class="tag is-info">0.4.2</span>
- </p>
- <p>
- You can set a table row as <strong>selected</strong> by appending the <code>is-selected</code> modifier on a <code><tr></code>
- </p>
- </div>
- {% capture table_example %}
- <table class="table">
- <thead>
- <tr>
- <th><abbr title="Position">Pos</abbr></th>
- <th>Team</th>
- <th><abbr title="Played">Pld</abbr></th>
- <th><abbr title="Won">W</abbr></th>
- <th><abbr title="Drawn">D</abbr></th>
- <th><abbr title="Lost">L</abbr></th>
- <th><abbr title="Goals for">GF</abbr></th>
- <th><abbr title="Goals against">GA</abbr></th>
- <th><abbr title="Goal difference">GD</abbr></th>
- <th><abbr title="Points">Pts</abbr></th>
- <th>Qualification or relegation</th>
- </tr>
- </thead>
- <tfoot>
- <tr>
- <th><abbr title="Position">Pos</abbr></th>
- <th>Team</th>
- <th><abbr title="Played">Pld</abbr></th>
- <th><abbr title="Won">W</abbr></th>
- <th><abbr title="Drawn">D</abbr></th>
- <th><abbr title="Lost">L</abbr></th>
- <th><abbr title="Goals for">GF</abbr></th>
- <th><abbr title="Goals against">GA</abbr></th>
- <th><abbr title="Goal difference">GD</abbr></th>
- <th><abbr title="Points">Pts</abbr></th>
- <th>Qualification or relegation</th>
- </tr>
- </tfoot>
- <tbody>
- <tr>
- <th>1</th>
- <td><a href="https://en.wikipedia.org/wiki/Leicester_City_F.C." title="Leicester City F.C.">Leicester City</a> <strong>(C)</strong>
- </td>
- <td>38</td>
- <td>23</td>
- <td>12</td>
- <td>3</td>
- <td>68</td>
- <td>36</td>
- <td>+32</td>
- <td>81</td>
- <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>
- </tr>
- <tr>
- <th>2</th>
- <td><a href="https://en.wikipedia.org/wiki/Arsenal_F.C." title="Arsenal F.C.">Arsenal</a></td>
- <td>38</td>
- <td>20</td>
- <td>11</td>
- <td>7</td>
- <td>65</td>
- <td>36</td>
- <td>+29</td>
- <td>71</td>
- <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>
- </tr>
- <tr>
- <th>3</th>
- <td><a href="https://en.wikipedia.org/wiki/Tottenham_Hotspur_F.C." title="Tottenham Hotspur F.C.">Tottenham Hotspur</a></td>
- <td>38</td>
- <td>19</td>
- <td>13</td>
- <td>6</td>
- <td>69</td>
- <td>35</td>
- <td>+34</td>
- <td>70</td>
- <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>
- </tr>
- <tr class="is-selected">
- <th>4</th>
- <td><a href="https://en.wikipedia.org/wiki/Manchester_City_F.C." title="Manchester City F.C.">Manchester City</a></td>
- <td>38</td>
- <td>19</td>
- <td>9</td>
- <td>10</td>
- <td>71</td>
- <td>41</td>
- <td>+30</td>
- <td>66</td>
- <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>
- </tr>
- <tr>
- <th>5</th>
- <td><a href="https://en.wikipedia.org/wiki/Manchester_United_F.C." title="Manchester United F.C.">Manchester United</a></td>
- <td>38</td>
- <td>19</td>
- <td>9</td>
- <td>10</td>
- <td>49</td>
- <td>35</td>
- <td>+14</td>
- <td>66</td>
- <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>
- </tr>
- <tr>
- <th>6</th>
- <td><a href="https://en.wikipedia.org/wiki/Southampton_F.C." title="Southampton F.C.">Southampton</a></td>
- <td>38</td>
- <td>18</td>
- <td>9</td>
- <td>11</td>
- <td>59</td>
- <td>41</td>
- <td>+18</td>
- <td>63</td>
- <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>
- </tr>
- <tr>
- <th>7</th>
- <td><a href="https://en.wikipedia.org/wiki/West_Ham_United_F.C." title="West Ham United F.C.">West Ham United</a></td>
- <td>38</td>
- <td>16</td>
- <td>14</td>
- <td>8</td>
- <td>65</td>
- <td>51</td>
- <td>+14</td>
- <td>62</td>
- <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>
- </tr>
- <tr>
- <th>8</th>
- <td><a href="https://en.wikipedia.org/wiki/Liverpool_F.C." title="Liverpool F.C.">Liverpool</a></td>
- <td>38</td>
- <td>16</td>
- <td>12</td>
- <td>10</td>
- <td>63</td>
- <td>50</td>
- <td>+13</td>
- <td>60</td>
- <td></td>
- </tr>
- <tr>
- <th>9</th>
- <td><a href="https://en.wikipedia.org/wiki/Stoke_City_F.C." title="Stoke City F.C.">Stoke City</a></td>
- <td>38</td>
- <td>14</td>
- <td>9</td>
- <td>15</td>
- <td>41</td>
- <td>55</td>
- <td>−14</td>
- <td>51</td>
- <td></td>
- </tr>
- <tr>
- <th>10</th>
- <td><a href="https://en.wikipedia.org/wiki/Chelsea_F.C." title="Chelsea F.C.">Chelsea</a></td>
- <td>38</td>
- <td>12</td>
- <td>14</td>
- <td>12</td>
- <td>59</td>
- <td>53</td>
- <td>+6</td>
- <td>50</td>
- <td></td>
- </tr>
- <tr>
- <th>11</th>
- <td><a href="https://en.wikipedia.org/wiki/Everton_F.C." title="Everton F.C.">Everton</a></td>
- <td>38</td>
- <td>11</td>
- <td>14</td>
- <td>13</td>
- <td>59</td>
- <td>55</td>
- <td>+4</td>
- <td>47</td>
- <td></td>
- </tr>
- <tr>
- <th>12</th>
- <td><a href="https://en.wikipedia.org/wiki/Swansea_City_A.F.C." title="Swansea City A.F.C.">Swansea City</a></td>
- <td>38</td>
- <td>12</td>
- <td>11</td>
- <td>15</td>
- <td>42</td>
- <td>52</td>
- <td>−10</td>
- <td>47</td>
- <td></td>
- </tr>
- <tr>
- <th>13</th>
- <td><a href="https://en.wikipedia.org/wiki/Watford_F.C." title="Watford F.C.">Watford</a></td>
- <td>38</td>
- <td>12</td>
- <td>9</td>
- <td>17</td>
- <td>40</td>
- <td>50</td>
- <td>−10</td>
- <td>45</td>
- <td></td>
- </tr>
- <tr>
- <th>14</th>
- <td><a href="https://en.wikipedia.org/wiki/West_Bromwich_Albion_F.C." title="West Bromwich Albion F.C.">West Bromwich Albion</a></td>
- <td>38</td>
- <td>10</td>
- <td>13</td>
- <td>15</td>
- <td>34</td>
- <td>48</td>
- <td>−14</td>
- <td>43</td>
- <td></td>
- </tr>
- <tr>
- <th>15</th>
- <td><a href="https://en.wikipedia.org/wiki/Crystal_Palace_F.C." title="Crystal Palace F.C.">Crystal Palace</a></td>
- <td>38</td>
- <td>11</td>
- <td>9</td>
- <td>18</td>
- <td>39</td>
- <td>51</td>
- <td>−12</td>
- <td>42</td>
- <td></td>
- </tr>
- <tr>
- <th>16</th>
- <td><a href="https://en.wikipedia.org/wiki/A.F.C._Bournemouth" title="A.F.C. Bournemouth">AFC Bournemouth</a></td>
- <td>38</td>
- <td>11</td>
- <td>9</td>
- <td>18</td>
- <td>45</td>
- <td>67</td>
- <td>−22</td>
- <td>42</td>
- <td></td>
- </tr>
- <tr>
- <th>17</th>
- <td><a href="https://en.wikipedia.org/wiki/Sunderland_A.F.C." title="Sunderland A.F.C.">Sunderland</a></td>
- <td>38</td>
- <td>9</td>
- <td>12</td>
- <td>17</td>
- <td>48</td>
- <td>62</td>
- <td>−14</td>
- <td>39</td>
- <td></td>
- </tr>
- <tr>
- <th>18</th>
- <td><a href="https://en.wikipedia.org/wiki/Newcastle_United_F.C." title="Newcastle United F.C.">Newcastle United</a> <strong>(R)</strong>
- </td>
- <td>38</td>
- <td>9</td>
- <td>10</td>
- <td>19</td>
- <td>44</td>
- <td>65</td>
- <td>−21</td>
- <td>37</td>
- <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>
- <tr>
- <th>19</th>
- <td><a href="https://en.wikipedia.org/wiki/Norwich_City_F.C." title="Norwich City F.C.">Norwich City</a> <strong>(R)</strong>
- </td>
- <td>38</td>
- <td>9</td>
- <td>7</td>
- <td>22</td>
- <td>39</td>
- <td>67</td>
- <td>−28</td>
- <td>34</td>
- <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>
- <tr>
- <th>20</th>
- <td><a href="https://en.wikipedia.org/wiki/Aston_Villa_F.C." title="Aston Villa F.C.">Aston Villa</a> <strong>(R)</strong>
- </td>
- <td>38</td>
- <td>3</td>
- <td>8</td>
- <td>27</td>
- <td>27</td>
- <td>76</td>
- <td>−49</td>
- <td>17</td>
- <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>
- </tbody>
- </table>
- {% endcapture %}
- <div class="example">
- {{table_example}}
- </div>
- {% highlight html %}
- {{table_example}}
- {% endhighlight %}
- <hr>
- <h3 class="title">Modifiers</h3>
- <div class="columns">
- <div class="column">
- <p>Add <strong>borders</strong> to all the cells.</p>
- </div>
- <div class="column">
- <code>table is-bordered</code>
- </div>
- <div class="column is-half">
- <table class="table is-bordered">
- <thead>
- <tr>
- <th>One</th>
- <th>Two</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Three</td>
- <td>Four</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="columns">
- <div class="column">
- <p>Add <strong>stripes</strong> to the table.</p>
- </div>
- <div class="column">
- <code>table is-striped</code>
- </div>
- <div class="column is-half">
- <table class="table is-striped">
- <thead>
- <tr>
- <th>One</th>
- <th>Two</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Three</td>
- <td>Four</td>
- </tr>
- <tr>
- <td>Five</td>
- <td>Six</td>
- </tr>
- <tr>
- <td>Seven</td>
- <td>Eight</td>
- </tr>
- <tr>
- <td>Nine</td>
- <td>Ten</td>
- </tr>
- <tr>
- <td>Eleven</td>
- <td>Twelve</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="columns">
- <div class="column">
- <p>Make the cells <strong>narrower</strong>.</p>
- </div>
- <div class="column">
- <code>table is-narrow</code>
- </div>
- <div class="column is-half">
- <table class="table is-narrow">
- <thead>
- <tr>
- <th>One</th>
- <th>Two</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Three</td>
- <td>Four</td>
- </tr>
- <tr>
- <td>Five</td>
- <td>Six</td>
- </tr>
- <tr>
- <td>Seven</td>
- <td>Eight</td>
- </tr>
- <tr>
- <td>Nine</td>
- <td>Ten</td>
- </tr>
- <tr>
- <td>Eleven</td>
- <td>Twelve</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="columns">
- <div class="column">
- <p>You can <strong>combine</strong> all three modifiers.</p>
- </div>
- <div class="column">
- <code>table is-bordered is-striped is-narrow</code>
- </div>
- <div class="column is-half">
- <table class="table is-bordered is-striped is-narrow">
- <thead>
- <tr>
- <th>One</th>
- <th>Two</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Three</td>
- <td>Four</td>
- </tr>
- <tr>
- <td>Five</td>
- <td>Six</td>
- </tr>
- <tr>
- <td>Seven</td>
- <td>Eight</td>
- </tr>
- <tr>
- <td>Nine</td>
- <td>Ten</td>
- </tr>
- <tr>
- <td>Eleven</td>
- <td>Twelve</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </section>
|