--- url: "https://web.dev/learn/css/focus" titulek: "Focus | web.dev" h1: "Focus Stay organized with collections Save and categorize content based on your preferences." popis: "Understand the importance of focus in your web applications. You'll find out how to manage focus, and how to make sure the path through your page works for people using a mouse, and those using the keyboard to navigate." jazyk: "en" kanonicka: "https://web.dev/learn/css/focus" drobecky: ["web.dev", "Resources", "CSS"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:40:16" znaku: 6129 slov: 1005 kodovani: "iso-8859-2" sha256: "00f6113d6d43be53f5975aaf8a953c9cac5d3815d491d4becf640916383a0892" --- Focus Stay organized with collections Save and categorize content based on your preferences. [The CSS Podcast - 018: Focus](https://thecsspodcast.libsyn.com/018-focus) On your webpage, you click a link that skips the user to the main content of the website. These are often referred to as skip links, or anchor links. When that link is activated by a keyboard, using the *tab* and *enter* keys, the main content container has a focus ring around it. Why is that? This is because the `
` has a `tabindex="-1"` attribute value, which means it can be programmatically focused. When the `
` is targeted—because the `#main-content` in the browser URL bar matches the `id`—it receives programmatic focus. It's tempting to remove the focus styles in these situations, but handling focus appropriately and with care helps to create a good, accessible, user experience. It can also be a great place to add some interest to interactions. Why is focus important? As a web developer, it's your job to make a website accessible and inclusive to all. Creating accessible focus states with CSS is a part of this responsibility. Focus styles assist people who use a device such as a keyboard or a [switch control](https://www.24a11y.com/2018/i-used-a-switch-control-for-a-day/) to navigate and interact with a website. If an element receives focus and there is no visual indication, a user may lose track of what is in focus. This can create navigation issues and result in unwanted behaviour if, say, the wrong link is followed. How elements get focus Certain elements are automatically focusable; these are elements that accept interaction and input, such as ``, `