layout
CSS Sidebar + Main Two-Column Layout
A sticky sidebar with main content using CSS Grid — collapses to single column on mobile.
The sidebar + main content layout is one of the most common page patterns in web applications. This snippet uses CSS Grid for a clean two-column layout with a fixed sidebar width and fluid main content area. The sidebar uses position: sticky to stay visible while the main content scrolls, and the whole layout collapses to a single column on mobile.
Usage Note
Set top: on .sidebar to match your navbar height so the sidebar sticks below the header. align-items: start on the grid container prevents the sidebar from stretching to match the main content height.
Tags
#sidebar#two-column#grid#sticky#layout#responsive