Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    How to make Magic Social Share Menu using HTML CSS and JS

    5 February 2026

    How to Make Memory Unmasked Game in HTML CSS & JavaScript

    4 February 2026

    How to Make Heart Animation in HTML CSS & JavaScript

    2 February 2026
    Facebook X (Twitter) Instagram YouTube Telegram Threads
    Coding StellaCoding Stella
    • Home
    • Blog
    • HTML & CSS
      • Login Form
    • JavaScript
    • Hire us!
    Coding StellaCoding Stella
    Home - HTML & CSS - How to make Bouncy Image Gallery using HTML & CSS
    HTML & CSS

    How to make Bouncy Image Gallery using HTML & CSS

    Coding StellaBy Coding Stella15 January 2024No Comments3 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Email WhatsApp Copy Link

    Hello cool coders! Today, let’s embark on a creative journey and build something fun – a Bouncy Image Gallery using only HTML and CSS. This project is perfect for both beginners looking to enhance their skills and seasoned developers wanting to add a playful element to their websites.

    We’ll keep it simple and stylish, using HTML for the structure and CSS to create that delightful bouncy effect. No need for complicated setups – just pure coding joy!

    So, join me in exploring the world of Bouncy Image Galleries. Whether you’re a coding enthusiast or just curious about web development, this tutorial offers a fantastic opportunity to learn and have a bit of fun along the way.

    Ready to make your images bounce? Let’s dive into the code and create a Bouncy Image Gallery that’ll add a touch of whimsy to your web projects. Let the coding adventure begin!

    HTML :

    This HTML code creates a webpage featuring a bouncy image grid using CSS Grid layout. It includes a fieldset with radio buttons and labels for different plant images. Each label has a background image specified by the --_img CSS variable. The selected radio button determines the displayed image. The styling is provided by an external stylesheet referenced in the <link> tag.

    <!DOCTYPE html>
    <html lang="en" >
    <head>
      <meta charset="UTF-8">
      <title>Bouncy image using GRID</title>
      <link rel="stylesheet" href="./style.css">
    
    </head>
    <body>
    <!-- partial:index.partial.html -->
    <fieldset>
      <label style="--_img: url(https://assets.codepen.io/2585/fiddle-leaf.jpeg)">
        <input type="radio" name="images" value="Fiddle Leaf">
      </label>
      <label style="--_img: url(https://assets.codepen.io/2585/pink-princess.jpeg)">
        <input type="radio" name="images" value="Pink Princess">
      </label>
      <label style="--_img: url(https://assets.codepen.io/2585/kara-eads-zcVArTF8Frs-unsplash.jpg)">
        <input type="radio" name="images" value="Monstera" checked>
      </label>
      <label style="--_img: url(https://assets.codepen.io/2585/pothos.jpeg)">
        <input type="radio" name="images" value="Pothos">
      </label>
      <label style="--_img: url(https://assets.codepen.io/2585/rubber-tree.webp)">
        <input type="radio" name="images" value="Rubber Tree">
      </label>
    </fieldset>
    <!-- partial -->
      
    </body>
    </html>

    CSS :

    This CSS code defines styles for a bouncy image grid layout using the Open Props library. It sets up a dynamic grid with five columns and handles transitions based on radio button selections. The images’ sizes change based on the selected input. It also includes styling for the overall layout, background, and focus effects.

    The demo.support layer configures the HTML and body elements for proper display.

    @import "https://unpkg.com/open-props" layer(design.system);
    
    @layer demo {
      fieldset {
        grid-template-columns:
          var(--col-1, 1fr)
          var(--col-2, 1fr)
          var(--col-3, 1fr)
          var(--col-4, 1fr)
          var(--col-5, 1fr);
    
        @media (prefers-reduced-motion: no-preference) {
          transition: grid-template-columns 2s var(--ease-spring-5);
        }
    
        &:has(label:nth-child(1) > input:checked) {
          --col-1: 5fr;
          --col-2: 3fr;
        }
        &:has(label:nth-child(2) > input:checked) {
          --col-1: 2fr;
          --col-2: 5fr;
          --col-3: 2fr;
        }
        &:has(label:nth-child(3) > input:checked) {
          --col-2: 2fr;
          --col-3: 5fr;
          --col-4: 2fr;
        }
        &:has(label:nth-child(4) > input:checked) {
          --col-3: 2fr;
          --col-4: 5fr;
          --col-5: 2fr;
        }
        &:has(label:nth-child(5) > input:checked) {
          --col-4: 3fr;
          --col-5: 5fr;
        }
    
        > label {
          background-image: var(--_img);
          background-position: center;
          background-size: auto 125%;
        }
      }
    }
    
    @layer demo.support {
      html {
        background: #14171E;
        block-size: 100%;
      }
    
      body {
        min-block-size: 100%;
        display: grid;
        place-content: center;
        padding: var(--size-5);
        gap: var(--size-5);
      }
    
      fieldset {
        inline-size: 80vw;
    
        display: grid;
        grid-auto-flow: column;
        grid-template-rows: 50vh;
        gap: var(--size-3);
        border: none;
    
        > label {
          cursor: pointer;
          border-radius: var(--radius-4);
    
          &:focus-within {
            outline: 1px solid #fff;
            outline-offset: 5px;
          }
    
          > input {
            opacity: 0;
          }
        }
      }
    }

    In conclusion, creating a Bouncy Image Gallery with HTML and CSS is a simple and enjoyable way to enhance your website. Whether you’re a seasoned coder or just starting out, this tutorial offers a playful touch to make your images stand out.

    Facing any problems in your project ? Stay confident! Click Download, obtain the source code, and tackle your coding issues with determination. May your coding experience be smooth and rewarding!

    gallery image gallery
    Share. Copy Link Twitter Facebook LinkedIn Email WhatsApp
    Previous ArticleHow to make Netflix Login page using HTML & CSS
    Next Article Frontend vs Backend : The Face and Brains of the Internet
    Coding Stella
    • Website

    Related Posts

    HTML & CSS

    How to make Magic Social Share Menu using HTML CSS and JS

    5 February 2026
    HTML & CSS

    How to Make Social Media Icons Popups in HTML and CSS

    31 January 2026
    HTML & CSS

    How to make Crazy Pencil Loader using HTML & CSS

    25 January 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Trending Post

    Master Frontend in 100 Days Ebook

    2 March 202432K Views

    How to make Modern Login Form using HTML & CSS | Glassmorphism

    11 January 202431K Views

    How to make I love you Animation in HTML CSS & JavaScript

    14 February 202424K Views

    How to make Valentine’s Day Card using HTML & CSS

    13 February 202415K Views
    Follow Us
    • Instagram
    • Facebook
    • YouTube
    • Twitter
    ads
    Featured Post

    Frontend vs Backend : The Face and Brains of the Internet

    17 January 2024

    How to make Hi-Tech Notification Button using HTML & CSS

    1 June 2024

    How to make 10+ Christmas Tree Animation using HTML CSS & JS

    24 December 2025

    How to Make Social Media Icons Popups in HTML and CSS

    31 January 2026
    Latest Post

    How to make Magic Social Share Menu using HTML CSS and JS

    5 February 2026

    How to Make Memory Unmasked Game in HTML CSS & JavaScript

    4 February 2026

    How to Make Heart Animation in HTML CSS & JavaScript

    2 February 2026

    How to Make Social Media Icons Popups in HTML and CSS

    31 January 2026
    Facebook X (Twitter) Instagram YouTube
    • About Us
    • Privacy Policy
    • Return and Refund Policy
    • Terms and Conditions
    • Contact Us
    • Buy me a coffee
    © 2026 Coding Stella. Made with 💙 by @coding.stella

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Looks like you're using an ad blocker. We rely on advertising to help fund our site.
    Okay! I understood