Skip to content

Suhas-Bhatt/CSS-Mini-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🎨 CSS Mini Project: Advanced Responsive Sliding Sidebar Menu

A premium, modern landing page with a responsive, animated sliding sidebar navigation menu built using pure HTML and CSS. It implements true glassmorphism, cascading transitions, a dimming backdrop overlay with click-to-close functionality, and responsive layouts—all without writing a single line of JavaScript.


🚀 Interactive Features

  • Zero-JS Checkbox Hack: Employs CSS sibling selectors tied to a hidden input checkbox to fully manage UI states.
  • 3D Hinge-Fold Sidebar: The sidebar swings open in 3D space from the left side of the screen using rotateY transforms and perspective contexts.
  • 3D Tilt & Float Hero Card: The landing page hero container card translates and rotates on hover, lifting in 3D depth towards the cursor and casting an expanded dynamic shadow.
  • 3D Icon Spins: Menu links and social media icons spin 360 degrees around their Y axis in 3D when hovered.
  • True Glassmorphism UI: Combines backdrop-filter: blur() with high-saturation blending and semi-transparent borders for high-end frosted glass styling (Apple/Stripe aesthetic).
  • Sequential Cascading Animations: Menu links slide in gracefully from left to right one-by-one (transition-delay stagger effect) whenever the menu is opened.
  • Click-to-Close Dimmer Overlay: A darkened backdrop fades in behind the sidebar when opened. Clicking anywhere on this backdrop instantly closes the menu.
  • Custom Design Tokens (CSS Variables): A clean design system driven by CSS variables for colors, fonts, sizing, and transition curves.
  • Fluid Responsiveness: Works flawlessly on all device sizes from large desktop monitors down to mobile screens using adaptive layout styling, media queries, and touch-optimizations (disabling heavy 3D effects on mobile).
  • Hero Landing Section: Features a premium hero introduction card with custom typography to complete the visual presentation.

🛠️ Technology Stack

  • HTML5: Clean semantic markup, hidden toggles, vector icons, and layout containers.
  • CSS3: Flexbox, absolute/fixed positioning, custom transitions, @keyframes, @media queries, and advanced sibling selectors (~).
  • Font Awesome (v6.4.0): Vector-based iconography for buttons, links, and branding.
  • Google Fonts: Integration of custom typography (Poppins and Allura).

📂 File Structure

├── index.html       # Visual layout, hero card, navigation list, overlay, and menu inputs
├── style.css        # Premium stylesheets, glassmorphic styles, transitions, and media queries
├── photo.jpg        # High-resolution background photo
└── README.md        # Detailed project documentation

🚀 Getting Started & Running the Project

Since this project consists of standard static HTML and CSS files, it can be run in several different ways:

Option 1: Direct File Execution (No Installation Required)

Simply navigate to your project directory and open the index.html file directly in any modern browser:

  • Windows (via File Explorer): Double-click index.html or right-click and select Open with > Google Chrome (or your preferred browser).
  • Command Line (Windows PowerShell):
    Start-Process "index.html"
  • Command Line (macOS / Linux):
    open index.html

Option 2: Using a Local Node.js Development Server (Recommended)

Running a local development server prevents potential browser CORS policy warnings when loading local files or assets:

  • Using npx (No installation needed):
    npx serve
  • Using Python (Built-in server): If you have Python installed, you can launch a simple HTTP server instantly:
    # For Python 3.x
    python -m http.server 8000
    
    # For Python 2.x
    python -m SimpleHTTPServer 8000
    After starting the server, navigate to http://localhost:8000 or http://localhost:5000 in your web browser.

Option 3: Using VS Code Extensions

If you are using Visual Studio Code:

  1. Search for and install the Live Server extension.
  2. Open the project folder in VS Code.
  3. Click the Go Live button at the bottom-right status bar, or right-click index.html and select Open with Live Server.

🧠 Advanced CSS Mechanisms

1. Click-to-Close Backdrop Overlay

The backdrop dimming overlay is a pure CSS mechanism that allows clicking outside the sidebar to close it.

  • HTML: An empty <label for="check" class="overlay"></label> is placed in the DOM. Since it is a label associated with the checkbox trigger (for="check"), clicking it automatically toggles the checkbox checked/unchecked state.
  • CSS:
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--overlay-bg);
        backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        z-index: 15;
        transition: opacity 0.4s ease, visibility 0.4s ease;
    }
    #check:checked ~ .overlay {
        opacity: 1;
        visibility: visible;
    }

2. Cascading Transition Delays

Instead of sliding all menu items in at the exact same moment, each item has a staggered entrance delay:

  • By default, the menu items are hidden and translated to the left:
    .sidebar_menu .menu li {
        transform: translateX(-35px);
        opacity: 0;
        transition: transform 0.4s var(--transition-curve), opacity 0.4s var(--transition-curve);
    }
  • When the sidebar becomes active (#check:checked), a staggered transition-delay is applied to each sibling item:
    #check:checked ~ .sidebar_menu .menu li {
        transform: translateX(0);
        opacity: 1;
    }
    #check:checked ~ .sidebar_menu .menu li:nth-child(1) { transition-delay: 0.08s; }
    #check:checked ~ .sidebar_menu .menu li:nth-child(2) { transition-delay: 0.13s; }
    #check:checked ~ .sidebar_menu .menu li:nth-child(3) { transition-delay: 0.18s; }
    /* ...and so on */

3. Glassmorphic Translucency

Uses CSS backdrop filters to blur the underlying elements (the background image) rather than just making the element background color translucent:

.sidebar_menu {
    background: var(--sidebar-bg); /* rgba(15, 18, 20, 0.45) */
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-right: 1px solid var(--sidebar-border);
}

4. 3D Transitions & Perspectives

By adding a perspective parameter to the parent container, we establish a 3D coordinate space where child elements can rotate and move along the X, Y, and Z axes:

  • The Hinge-Fold Sidebar: The sidebar swings open like a 3D door hinge from the left edge of the screen:
    .main_box { perspective: 1500px; }
    .sidebar_menu {
        transform: rotateY(-90deg);
        transform-origin: left center;
        transition: transform 0.5s var(--transition-curve);
    }
    #check:checked ~ .sidebar_menu { transform: rotateY(0deg); }
  • Interactive 3D Hover on Hero Card: The hero container lifts off the page background and tilts in 3D space:
    .hero_container {
        transform-style: preserve-3d;
        transform: translate3d(0, 0, 0);
        transition: transform 0.5s var(--transition-curve);
    }
    .hero_container:hover {
        transform: translate3d(0, -8px, 20px) rotateX(1deg) rotateY(1.5deg);
    }
    The inner text nodes inside the container card use translateZ(...) values (e.g. translateZ(35px)) to create a subtle parallax depth separation, lifting the text off the glass backing card.
  • 3D Icon Spinners: Hovering over icons triggers a 360-degree rotation around the Y axis:
    .sidebar_menu .menu li:hover i {
        transform: scale(1.2) rotateY(360deg);
    }

🎨 Customizable Design Tokens (CSS Variables)

To modify colors, fonts, or animations, you can edit the CSS Variables defined at the top of style.css:

Variable Description Default Value
--font-main Primary font family 'Poppins', sans-serif
--font-accent Script font family for branding 'Allura', cursive
--sidebar-width General width of the sidebar panel 300px
--sidebar-bg Semi-transparent background color rgba(15, 18, 20, 0.45)
--primary-color Action color (buttons, active hovers) #3b82f6 (Indigo/Blue)
--overlay-bg Color of the screen-dimming overlay rgba(0, 0, 0, 0.55)
--transition-speed Toggle animation duration 0.4s
--transition-curve Speed acceleration curve cubic-bezier(0.16, 1, 0.3, 1)

📱 Mobile Responsiveness

The design utilizes CSS Media Queries to adapt fluidly to small screen sizes:

  1. Sidebar Adjustments: On screens narrower than 480px, the sidebar width shifts from 300px to 85vw (85% of screen width) so it fits comfortably.
  2. Action Buttons: Welcome card actions stack vertically to prevent text clipping.
  3. Floating Trigger: The toggle button scales down slightly and repositions to ensure optimal visibility on mobile screens.

Releases

Packages

Contributors

Languages