image.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ---
  2. layout: documentation
  3. doc-tab: elements
  4. doc-subtab: image
  5. ---
  6. {% include subnav-elements.html %}
  7. <section class="section">
  8. <div class="container">
  9. <h1 class="title">Images</h1>
  10. <h2 class="subtitle">
  11. A container for <strong>responsive images</strong>
  12. </h2>
  13. <hr>
  14. <div class="content">
  15. <p>Because images can take a few seconds to load (or not at all), use the <code>.image</code> container to specify a <strong>precisely sized</strong> container so that your layout isn't broken because of image loading or image errors.</p>
  16. </div>
  17. <div class="example">
  18. <figure class="image is-128x128">
  19. <img src="http://placehold.it/128x128">
  20. </figure>
  21. </div>
  22. {% highlight html %}
  23. <figure class="image is-128x128">
  24. <img src="http://placehold.it/128x128">
  25. </figure>
  26. {% endhighlight %}
  27. <hr>
  28. <h3 class="title">Fixed square images</h3>
  29. <div class="content">
  30. <p>There are <strong>7</strong> dimensions to choose from, useful for <strong>avatars</strong>:</p>
  31. </div>
  32. <table class="table is-bordered">
  33. <tbody>
  34. <tr>
  35. <td><code>image is-16x16</code></td>
  36. <td><figure class="image is-16x16"><img src="http://placehold.it/16x16"></figure></td>
  37. <td>16x16px</td>
  38. </tr>
  39. <tr>
  40. <td><code>image is-24x24</code></td>
  41. <td><figure class="image is-24x24"><img src="http://placehold.it/24x24"></figure></td>
  42. <td>24x24px</td>
  43. </tr>
  44. <tr>
  45. <td><code>image is-32x32</code></td>
  46. <td><figure class="image is-32x32"><img src="http://placehold.it/32x32"></figure></td>
  47. <td>32x32px</td>
  48. </tr>
  49. <tr>
  50. <td><code>image is-48x48</code></td>
  51. <td><figure class="image is-48x48"><img src="http://placehold.it/48x48"></figure></td>
  52. <td>48x48px</td>
  53. </tr>
  54. <tr>
  55. <td><code>image is-64x64</code></td>
  56. <td><figure class="image is-64x64"><img src="http://placehold.it/64x64"></figure></td>
  57. <td>64x64px</td>
  58. </tr>
  59. <tr>
  60. <td><code>image is-96x96</code></td>
  61. <td><figure class="image is-96x96"><img src="http://placehold.it/96x96"></figure></td>
  62. <td>96x96px</td>
  63. </tr>
  64. <tr>
  65. <td><code>image is-128x128</code></td>
  66. <td><figure class="image is-128x128"><img src="http://placehold.it/128x128"></figure></td>
  67. <td>128x128px</td>
  68. </tr>
  69. </tbody>
  70. </table>
  71. <h4 class="title is-4">Retina images</h4>
  72. <div class="content">
  73. <p>Because the image is fixed in size, you can use an image that is <strong>twice as big</strong>. So for example, in a <code>128x128</code> container, you can use a <code>256x256</code> image, but resized to <strong>128x128</strong> pixels.</p>
  74. </div>
  75. <div class="example">
  76. <figure class="image is-128x128">
  77. <img src="http://placehold.it/256x256">
  78. </figure>
  79. </div>
  80. {% highlight html %}
  81. <figure class="image is-128x128">
  82. <img src="http://placehold.it/256x256">
  83. </figure>
  84. {% endhighlight %}
  85. <hr>
  86. <h3 class="title">Responsive images with ratios</h3>
  87. <div class="content">
  88. <p>If you don't know the exact dimensions but know the <strong>ratio</strong> instead, you can use one of the <strong>5 ratio modifers</strong>:</p>
  89. </div>
  90. <table id="images" class="table is-bordered">
  91. <tbody>
  92. <tr>
  93. <td><code>image is-square</code></td>
  94. <td><figure class="image is-square"><img src="http://placehold.it/480x480"></figure></td>
  95. <td>Square (or 1by1)</td>
  96. </tr>
  97. <tr>
  98. <td><code>image is-1by1</code></td>
  99. <td><figure class="image is-1by1"><img src="http://placehold.it/480x480"></figure></td>
  100. <td>1 by 1</td>
  101. </tr>
  102. <tr>
  103. <td><code>image is-4by3</code></td>
  104. <td><figure class="image is-4by3"><img src="http://placehold.it/640x480"></figure></td>
  105. <td>4 by 3</td>
  106. </tr>
  107. <tr>
  108. <td><code>image is-3by2</code></td>
  109. <td><figure class="image is-3by2"><img src="http://placehold.it/480x320"></figure></td>
  110. <td>3 by 2</td>
  111. </tr>
  112. <tr>
  113. <td><code>image is-16by9</code></td>
  114. <td><figure class="image is-16by9"><img src="http://placehold.it/640x360"></figure></td>
  115. <td>16 by 9</td>
  116. </tr>
  117. <tr>
  118. <td><code>image is-2by1</code></td>
  119. <td><figure class="image is-2by1"><img src="http://placehold.it/640x320"></figure></td>
  120. <td>2 by 1</td>
  121. </tr>
  122. </tbody>
  123. </table>
  124. <div class="content">
  125. <p>The <code>.image</code> container will take up the <strong>whole width</strong> while maintaining the perfect ratio.</p>
  126. </div>
  127. </div>
  128. </section>