index.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. ---
  2. layout: examples
  3. title: Masonry example
  4. extra_js:
  5. - src: "https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js"
  6. integrity: "sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D"
  7. async: true
  8. ---
  9. <main class="container py-5">
  10. <h1>Bootstrap and Masonry</h1>
  11. <p class="lead">Integrate <a href="https://masonry.desandro.com/">Masonry</a> with the Bootstrap grid system and cards component.</p>
  12. <p>Masonry is not included in Bootstrap. Add it by including the JavaScript plugin manually, or using a CDN like so:</p>
  13. <pre><code>
  14. &lt;script src=&quot;https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js&quot; integrity=&quot;sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D&quot; crossorigin=&quot;anonymous&quot; async&gt;&lt;/script&gt;
  15. </code></pre>
  16. <p>By adding <code>data-masonry='{"percentPosition": true }'</code> to the <code>.row</code> wrapper, we can combine the powers of Bootstrap's responsive grid and Masonry's positioning.</p>
  17. <hr class="my-5">
  18. <div class="row" data-masonry='{"percentPosition": true }'>
  19. <div class="col-sm-6 col-lg-4 mb-4">
  20. <div class="card">
  21. {{< placeholder width="100%" height="200" class="card-img-top" text="Image cap" >}}
  22. <div class="card-body">
  23. <h5 class="card-title">Card title that wraps to a new line</h5>
  24. <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="col-sm-6 col-lg-4 mb-4">
  29. <div class="card p-3">
  30. <figure class="p-3 mb-0">
  31. <blockquote class="blockquote">
  32. <p>A well-known quote, contained in a blockquote element.</p>
  33. </blockquote>
  34. <figcaption class="blockquote-footer mb-0 text-muted">
  35. Someone famous in <cite title="Source Title">Source Title</cite>
  36. </figcaption>
  37. </figure>
  38. </div>
  39. </div>
  40. <div class="col-sm-6 col-lg-4 mb-4">
  41. <div class="card">
  42. {{< placeholder width="100%" height="200" class="card-img-top" text="Image cap" >}}
  43. <div class="card-body">
  44. <h5 class="card-title">Card title</h5>
  45. <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
  46. <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="col-sm-6 col-lg-4 mb-4">
  51. <div class="card bg-primary text-white text-center p-3">
  52. <figure class="mb-0">
  53. <blockquote class="blockquote">
  54. <p>A well-known quote, contained in a blockquote element.</p>
  55. </blockquote>
  56. <figcaption class="blockquote-footer mb-0 text-white">
  57. Someone famous in <cite title="Source Title">Source Title</cite>
  58. </figcaption>
  59. </figure>
  60. </div>
  61. </div>
  62. <div class="col-sm-6 col-lg-4 mb-4">
  63. <div class="card text-center">
  64. <div class="card-body">
  65. <h5 class="card-title">Card title</h5>
  66. <p class="card-text">This card has a regular title and short paragraph of text below it.</p>
  67. <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="col-sm-6 col-lg-4 mb-4">
  72. <div class="card">
  73. {{< placeholder width="100%" height="260" class="card-img" text="Card image" >}}
  74. </div>
  75. </div>
  76. <div class="col-sm-6 col-lg-4 mb-4">
  77. <div class="card p-3 text-end">
  78. <figure class="mb-0">
  79. <blockquote class="blockquote">
  80. <p>A well-known quote, contained in a blockquote element.</p>
  81. </blockquote>
  82. <figcaption class="blockquote-footer mb-0 text-muted">
  83. Someone famous in <cite title="Source Title">Source Title</cite>
  84. </figcaption>
  85. </figure>
  86. </div>
  87. </div>
  88. <div class="col-sm-6 col-lg-4 mb-4">
  89. <div class="card">
  90. <div class="card-body">
  91. <h5 class="card-title">Card title</h5>
  92. <p class="card-text">This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.</p>
  93. <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </main>