Close Menu

    Subscribe to Updates

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

    What's Hot

    How to create Social media popup hover menu using HTML and CSS

    25 June 2025

    How to create Valentine’s Love Button Animation using HTML CSS and JS

    23 June 2025

    How to create Magic Indicator Menu using HTML CSS and JS

    20 June 2025
    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 create Social media popup hover menu using HTML and CSS

    25 June 2025
    HTML & CSS

    How to create Awesome Cool Loading Animation using HTML CSS and JS

    16 June 2025
    HTML & CSS

    How to Create Animated Bicycle Product Card using HTML & CSS

    1 June 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Trending Post

    Master Frontend in 100 Days Ebook

    2 March 202419K Views

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

    11 January 202417K Views

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

    14 February 202416K Views

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

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

    How to create Social media popup hover menu using HTML and CSS

    25 June 2025

    How to create Login and Signup Form using HTML CSS and JS

    9 June 2025

    How to Create Skeleton Loading Animation in HTML & CSS

    12 January 2024

    How to create Cross Road Game using HTML CSS and JS

    2 May 2025
    Latest Post

    How to create Social media popup hover menu using HTML and CSS

    25 June 2025

    How to create Valentine’s Love Button Animation using HTML CSS and JS

    23 June 2025

    How to create Magic Indicator Menu using HTML CSS and JS

    20 June 2025

    How to create Awesome Cool Loading Animation using HTML CSS and JS

    16 June 2025
    Facebook X (Twitter) Instagram YouTube
    • About Us
    • Privacy Policy
    • Return and Refund Policy
    • Terms and Conditions
    • Contact Us
    • Buy me a coffee
    © 2025 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