Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.15 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. * {
  6.   box-sizing: border-box;
  7. }
  8.  
  9. .column {
  10.   float: left;
  11.   width: 33.33%;
  12.   padding: 0px;
  13. }
  14.  
  15. /* Clearfix (clear floats) */
  16. .row::after {
  17.   content: "";
  18.   clear: both;
  19.   display: table;
  20. }
  21.  
  22. /* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
  23. @media screen and (max-width: 500px) {
  24.   .column {
  25.     width: 100%;
  26.   }
  27. }
  28. </style>
  29. </head>
  30. <body>
  31.  
  32. <h2>Responsive "Side-by-Side" Images</h2>
  33. <p>How to create side-by-side images with the CSS float property. On screens that are 500px wide or less, the images will stack on top of each other instead of next to each other:</p>
  34. <p>Resize the browser window to see the effect.</p>
  35.  
  36. <div class="row">
  37.   <div class="column">
  38.     <img src="https://www.w3schools.com/howto/img_snow.jpg" alt="Snow" style="width:100%">
  39.   </div>
  40.   <div class="column">
  41.     <img src="https://www.w3schools.com/howto/img_forest.jpg" alt="Forest" style="width:100%">
  42.   </div>
  43.   <div class="column">
  44.     <img src="https://www.w3schools.com/howto/img_forest.jpg" alt="Mountains" style="width:100%">
  45.   </div>
  46. </div>
  47.  
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement