danrim

Practice with grid image display

Jun 2nd, 2019
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.30 KB | None | 0 0
  1. HTML
  2.  
  3. <body>
  4.   <div class="gallery">
  5.  
  6.    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt=v">
  7.                                                                                           <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt=v">
  8.        <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt=v">
  9.                                                                                               <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt=v">
  10.        <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt=v">
  11.                                                                                               <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt=v">
  12.                                                                             </div>
  13. </body>
  14.  
  15. CSS
  16.  
  17. * {
  18.   margin: 0;
  19.   padding: 0;
  20.   box-sizing:border-box;
  21. }
  22.  
  23. .gallery {
  24.  
  25.   display:grid;
  26. /*   grid-template-columns: repeat(auto-fit, 200px); */
  27.       grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  28.       grid-column-gap: 15px;
  29.       grid-row-gap: 15px;
  30. /*   grid-template-rows: 100px 100px; */
  31. }
  32.  
  33. .gallery img {
  34.  width: 100%;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment