image.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. ---
  2. title: Image
  3. layout: documentation
  4. doc-tab: elements
  5. doc-subtab: image
  6. dimensions:
  7. - 16
  8. - 24
  9. - 32
  10. - 48
  11. - 64
  12. - 96
  13. - 128
  14. ---
  15. {% capture image %}
  16. <figure class="image is-128x128">
  17. <img src="{{site.url}}/images/placeholders/128x128.png">
  18. </figure>
  19. {% endcapture %}
  20. {% capture retina_image %}
  21. <figure class="image is-128x128">
  22. <img src="{{site.url}}/images/placeholders/256x256.png">
  23. </figure>
  24. {% endcapture %}
  25. {% include subnav-elements.html %}
  26. <section class="section">
  27. <div class="container">
  28. <h1 class="title">Images</h1>
  29. <h2 class="subtitle">
  30. A container for <strong>responsive images</strong>
  31. </h2>
  32. {%
  33. include meta.html
  34. colors=false
  35. sizes=false
  36. variables=true
  37. %}
  38. <hr>
  39. <div class="content">
  40. <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>
  41. </div>
  42. {% include snippet.html content=image %}
  43. {% include anchor.html name="Fixed square images" %}
  44. <div class="content">
  45. <p>There are <strong>7</strong> dimensions to choose from, useful for <strong>avatars</strong>:</p>
  46. </div>
  47. <table class="table is-bordered">
  48. <tbody>
  49. {% for dimension in page.dimensions %}
  50. <tr>
  51. <td><code>image is-{{ dimension }}x{{ dimension }}</code></td>
  52. <td><figure class="image is-{{ dimension }}x{{ dimension }}"><img src="{{site.url}}/images/placeholders/{{ dimension }}x{{ dimension }}.png"></figure></td>
  53. <td>{{ dimension }}x{{ dimension }}px</td>
  54. </tr>
  55. {% endfor %}
  56. </tbody>
  57. </table>
  58. {% include anchor.html name="Retina images" %}
  59. <div class="content">
  60. <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>
  61. </div>
  62. {% include snippet.html content=retina_image %}
  63. {% include anchor.html name="Responsive images with ratios" %}
  64. <div class="content">
  65. <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 modifiers</strong>:</p>
  66. </div>
  67. <table id="images" class="table is-bordered">
  68. <tbody>
  69. <tr>
  70. <td><code>image is-square</code></td>
  71. <td><figure class="image is-square"><img src="{{site.url}}/images/placeholders/480x480.png"></figure></td>
  72. <td>Square (or 1by1)</td>
  73. </tr>
  74. <tr>
  75. <td><code>image is-1by1</code></td>
  76. <td><figure class="image is-1by1"><img src="{{site.url}}/images/placeholders/480x480.png"></figure></td>
  77. <td>1 by 1</td>
  78. </tr>
  79. <tr>
  80. <td><code>image is-4by3</code></td>
  81. <td><figure class="image is-4by3"><img src="{{site.url}}/images/placeholders/640x480.png"></figure></td>
  82. <td>4 by 3</td>
  83. </tr>
  84. <tr>
  85. <td><code>image is-3by2</code></td>
  86. <td><figure class="image is-3by2"><img src="{{site.url}}/images/placeholders/480x320.png"></figure></td>
  87. <td>3 by 2</td>
  88. </tr>
  89. <tr>
  90. <td><code>image is-16by9</code></td>
  91. <td><figure class="image is-16by9"><img src="{{site.url}}/images/placeholders/640x360.png"></figure></td>
  92. <td>16 by 9</td>
  93. </tr>
  94. <tr>
  95. <td><code>image is-2by1</code></td>
  96. <td><figure class="image is-2by1"><img src="{{site.url}}/images/placeholders/640x320.png"></figure></td>
  97. <td>2 by 1</td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <div class="content">
  102. <p>The <code>.image</code> container will take up the <strong>whole width</strong> while maintaining the perfect ratio.</p>
  103. </div>
  104. {% include variables.html type='element' %}
  105. </div>
  106. </section>