--- url: "https://www.w3.org/WAI/WCAG22/Techniques/css/C34" titulek: "C34: Using media queries to un-fixing sticky headers / footers | WAI | W3C" h1: "Technique C34:Using media queries to un-fixing sticky headers / footers" popis: "" jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 05:31:51" znaku: 5074 slov: 827 kodovani: "utf-8" sha256: "68aa1465afdb96b84b591d7b2cfa6233497c34e6e9f5ff4f0c4e988b51a94b65" --- # Technique C34:Using media queries to un-fixing sticky headers / footers ## About this Technique This technique relates to [1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow) (**Advisory**). This technique applies to CSS and HTML. Techniques are examples of ways to meet Web Content Accessibility Guidelines (WCAG). They are **not required** to meet WCAG. Content can satisfy the normative requirements of WCAG even if it does not use any of the documented techniques. See [About WCAG Techniques](https://www.w3.org/WAI/WCAG22/Techniques/about). ## Description The objective of this technique is to be able to present content with sticky headers and footers when there is enough space. This is done by using `min-height`, `max-height`, and `min-width` media queries techniques that adapt to the available space of the viewport. Sticky regions always stay visible in the viewport while the other content will disappear underneath when scrolling. In terms of content visibility, this is often not a problem on the desktop and on mobile devices in portrait orientation. However, when using mobile devices in landscape orientation or when zooming in on the desktop, sticky regions may block a big portion of the screen: the height of the sticky region may leave only a small part of the screen for the display of page content. Disabling, or un-fixing sticky regions, is an effective way to allow for enough available space when users prefer different reading and zoom preferences or when using landscape mode. Note Be aware that sticky regions can create disadvantages for keyboard users and should therefore be used judiciously. The problem for keyboard users tabbing through a page with a fixed header is that once the page has started to scroll, tabbing backwards to reach interactive elements higher up on the page will often mean that the focus becomes invisible once it moves behind the sticky header. Users must then scroll up to be able to see the focus, something they may not necessarily be aware of. In the same way the visible focus can disappear behind a sticky footer, so users would need to scroll down to be able to see their focus position, which is a major inconvenience. The basic approach for un-fixing sticky headers / footers is to: 1. Define the first sticky regions using media query `min-height` properties, so they get fixed or un-fixed depending on the available space; 2. Define other sticky regions using media query `min-width` and `max-height` properties for specific viewport sizes, so they get fixed or un-fixed depending on the available space, e.g. for tablets depending on the portrait or landscape position of the device. ## Examples ### Example 1: Un-fix sticky headers / footers in HTML and CSS The following example uses HTML and CSS to un-fix sticky headers / footers. The sticky regions get un-fixed as the height of the viewport is limited or the orientation is changed. When the `min-height` property matches the viewport space defined via media queries, regions which are not sticky get fixed or vice versa. This particular example uses the CSS `min-height`, `max-height` and `min-width` media query properties. ```