You are on: Liquid

Off-canvas Left

A pure-CSS off-canvas navigation pattern using Pico.css — no JavaScript required.

HTML Structure

The page is built around three key elements:

The burger link uses href="#menu" and the close/backdrop links use href="#". When clicked, the browser's fragment identifier changes, which the CSS :target pseudo-class detects to toggle the panel open or closed — zero JavaScript.

CSS: Off-canvas Mechanics

The panel and backdrop are positioned fixed and hidden by default:

Key principles: z-index: 999-1001 layers the backdrop below the panel but above all page content. pointer-events controls interactivity — when the menu is not targeted, clicks pass right through.

CSS: Header & Responsive

CSS Variables & Theming

Two custom properties drive the layout:

Pico's built-in variables handle the rest: --pico-card-background-color for panel/header/footer backgrounds, --pico-muted-border-color for borders, --pico-muted-color for secondary text.

Accessibility

No JavaScript Required

This pattern relies entirely on the CSS :target pseudo-class, which matches when a fragment identifier in the URL corresponds to an element's id. Clicking a link like <a href="#menu"> changes the URL to #menu, which activates #menu:target. Clicking the backdrop or close link sets the URL back to # (the top of the page), deactivating the target. This is a robust, accessible pattern that works without a single line of JavaScript.