How do you move a sidebar below the main content on small screens?

Place the main content before the sidebar in the HTML when that is the logical reading order, then use Grid to position them side by side only when space allows. On narrow screens, a single-column base layout naturally leaves the sidebar below the main content without visual reordering.
.page-layout {
display: grid;
gap: 2rem;
}
@media (min-width: 60rem) {
.page-layout {
grid-template-columns: minmax(0, 1fr) 18rem;
}
}
This mobile-first structure keeps reading, focus and screen-reader order consistent. If the desktop design shows the sidebar on the left while the main content remains first in the DOM, named grid areas can place it visually, but test the resulting mismatch carefully for keyboard and magnification users.
Decide whether the whole sidebar belongs below the article. A filter panel may need a button and dialog or disclosure pattern on mobile, while related articles can follow the content normally. Do not hide required filters or account controls merely because the sidebar no longer fits beside the page.
Test anchors, sticky behavior and focus after the layout changes. Remove desktop-only fixed widths and give both columns min-width: 0 where long content can overflow. The small-screen flow should work as a complete document before the wide two-column enhancement applies. Verify the behavior across the full width range, including spaces between design breakpoints. Long labels, translated copy and enlarged text can expose constraints that short sample content never reaches. Verify the behavior across the full width range, including spaces between design breakpoints. Long labels, translated copy and enlarged text can expose constraints that short sample content never reaches.