Image Gallery SourceCode

HTML Code

          
            <!DOCTYPE html>
            <html lang="en">
            <head>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>Simple Gallery</title>
                <link rel="stylesheet" href="style.css">
            </head>
            <body>
                <header>
                    <h1>Image Gallery</h1>
                </header>
                <section class="gallery">
                    <div class="gallery-item">
                        <img src="https://via.placeholder.com/200" alt="Image 1">
                    </div>
                    <div class="gallery-item">
                        <img src="https://via.placeholder.com/200" alt="Image 2">
                    </div>
                    <div class="gallery-item">
                        <img src="https://via.placeholder.com/200" alt="Image 3">
                    </div>
                    <div class="gallery-item">
                        <img src="https://via.placeholder.com/200" alt="Image 4">
                    </div>
                    <div class="gallery-item">
                        <img src="https://via.placeholder.com/200" alt="Image 5">
                    </div>
                    <div class="gallery-item">
                        <img src="https://via.placeholder.com/200" alt="Image 6">
                    </div>
                    <div class="gallery-item">
                      <img src="https://via.placeholder.com/200" alt="Image 7">
                    </div>
                    <div class="gallery-item">
                      <img src="https://via.placeholder.com/200" alt="Image 8">
                    </div>
                </section>
            </body>
            </html>
          
        

CSS Code

          
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
              }
              
              body {
                font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
                background-color: #f4f4f4;
                font-weight: bold;
                font-size: 18px;
              }
              
              header {
                text-align: center;
                padding: 20px;
                background-color: #333;
                color: white;
              }
              
              h1 {
                font-size: 2em;
              }
              
              
              .gallery {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                gap: 10px;
                padding: 20px;
                background-color: #fff;
              }
              
              .gallery-item {
                width: 200px;
                height: 200px;
                overflow: hidden;
                border: 2px solid #ddd;
                transition: transform 0.3s;
              }
              
              .gallery-item img {
                width: 100%;
                height: 100%;
                object-fit: cover;
              }
              
              .gallery-item:hover {
                transform: scale(1.1);
                border-color: #00bcd4;
              }