Advertisement
TheiPhoneFan

Image Gallery Revised From W3Schools

Mar 26th, 2024 (edited)
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.97 KB | None | 0 0
  1. <!-- Created by TheiPhoneFan on 2024-03-26 -->
  2. <!-- Previews 6.0.3, 2022-2024 -->
  3. <!-- Original: https://www.w3schools.com/css/tryit.asp?filename=trycss_image_gallery -->
  4. <!DOCTYPE html>
  5. <html>
  6.  
  7. <head>
  8.     <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,100,700,900" rel="stylesheet" type="text/css">
  9.     <link rel="stylesheet" href="./theme/style.css" />
  10.     <style>
  11.         div.gallery {
  12.             border: 1px solid #ccc;
  13.             border-radius: 16px;
  14.         }
  15.  
  16.         div.gallery:hover {
  17.             border: 1px solid #777;
  18.         }
  19.  
  20.         div.gallery img {
  21.             width: 100%;
  22.             height: auto;
  23.             border-radius: 16px 16px 0px 0px;
  24.         }
  25.  
  26.         div.desc {
  27.             padding: 15px;
  28.             text-align: center;
  29.            font-family: 'Roboto', sans-serif;
  30.         }
  31.  
  32.         * {
  33.             box-sizing: border-box;
  34.         }
  35.  
  36.         .responsive {
  37.             padding: 0 6px;
  38.             float: left;
  39.             width: 24.99999%;
  40.         }
  41.  
  42.         @media only screen and (max-width: 700px) {
  43.             .responsive {
  44.                 width: 49.99999%;
  45.                 margin: 6px 0;
  46.             }
  47.         }
  48.  
  49.         @media only screen and (max-width: 500px) {
  50.             .responsive {
  51.                 width: 100%;
  52.             }
  53.         }
  54.  
  55.         .clearfix:after {
  56.             content: "";
  57.             display: table;
  58.             clear: both;
  59.         }
  60.     </style>
  61. </head>
  62.  
  63. <body>
  64.     <div class="responsive">
  65.         <div class="gallery">
  66.             <a target="_blank" href="https://www.w3schools.com/css/img_5terre.jpg">
  67.                 <img src="https://www.w3schools.com/css/img_5terre.jpg" alt="Cinque Terre" width="600" height="400">
  68.             </a>
  69.             <div class="desc">Add a description of the image here</div>
  70.         </div>
  71.     </div>
  72.  
  73.  
  74.     <div class="responsive">
  75.         <div class="gallery">
  76.             <a target="_blank" href="https://www.w3schools.com/css/img_forest.jpg">
  77.                 <img src="https://www.w3schools.com/css/img_forest.jpg" alt="Forest" width="600" height="400">
  78.             </a>
  79.             <div class="desc">Add a description of the image here</div>
  80.         </div>
  81.     </div>
  82.  
  83.     <div class="responsive">
  84.         <div class="gallery">
  85.             <a target="_blank" href="https://www.w3schools.com/css/img_lights.jpg">
  86.                 <img src="https://www.w3schools.com/css/img_lights.jpg" alt="Northern Lights" width="600" height="400">
  87.             </a>
  88.             <div class="desc">Add a description of the image here</div>
  89.         </div>
  90.     </div>
  91.  
  92.     <div class="responsive">
  93.         <div class="gallery">
  94.             <a target="_blank" href="https://www.w3schools.com/css/img_mountains.jpg">
  95.                 <img src="https://www.w3schools.com/css/img_mountains.jpg" alt="Mountains" width="600" height="400">
  96.             </a>
  97.             <div class="desc">Add a description of the image here</div>
  98.         </div>
  99.     </div>
  100. </body>
  101. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement