--- url: "https://web.dev/articles/add-touch-to-your-site" titulek: "Add touch to your site | Articles | web.dev" h1: "Add touch to your site Stay organized with collections Save and categorize content based on your preferences." popis: "Touchscreens are available on more and more devices, from phones up to desktop screens. Your app should respond to their touch in intuitive and beautiful ways." jazyk: "en" kanonicka: "https://web.dev/articles/add-touch-to-your-site" drobecky: ["Articles", "Add touch to your site"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 22:27:09" znaku: 21437 slov: 3108 kodovani: "iso-8859-2" sha256: "0d4a8b428789d780d6fecc3fac4953c9f3bd6abcf00dde001b372fa2a471b4ea" --- Add touch to your site Stay organized with collections Save and categorize content based on your preferences. Touchscreens are available on more and more devices, from phones up to desktop screens. Your app should respond to their touch in intuitive and beautiful ways. Matt Gaunt Touchscreens are available on more and more devices, ranging from phones to desktop screens. When your users choose to interact with your UI, your app should respond to their touch in intuitive ways. Respond to element states Have you ever touched or clicked an element on a web page and questioned whether the site actually detected it? Simply altering the color of an element as users touch or interact with parts of your UI gives a basic reassurance that your site is working. Not only does this alleviate frustration, it can also give a snappy and responsive feel. DOM elements can inherit any of the following states: default, focus, hover and active. To change our UI for each of these states, we need to apply styles to the following pseudo classes `:hover`, `:focus` and `:active` as shown below: `.btn { background-color: #4285f4; } .btn:hover { background-color: #296cdb; } .btn:focus { background-color: #0f52c1; /* The outline parameter suppresses the border color / outline when focused */ outline: 0; } .btn:active { background-color: #0039a8; }` [Try it](https://googlesamples.github.io/web-fundamentals/fundamentals/design-and-ux/input/touch/states-example.html) On most mobile browsers *hover* and/or *focus* states will apply to an element after it's been tapped. Consider carefully what styles you set and how they will look to the user after they finish their touch. Suppressing default browser styles Once you add styles for the different states, you'll notice that most browsers implement their own styles in response to a user’s touch. This is largely because when mobile devices first launched, a number of sites didn’t have styling for the `:active` state. As a result, many browsers added additional highlight color or style to give the user feedback. Most browsers use the `outline` CSS property to display a ring around an element when an element is focused. You can suppress it with: `.btn:focus { outline: 0; /* Add replacement focus styling here (i.e. border) */ }` Safari and Chrome add a tap highlight color which can be prevented with the `-webkit-tap-highlight-color` CSS property: `/* Webkit / Chrome Specific CSS to remove tap highlight color */ .btn { -webkit-tap-highlight-color: transparent; }` [Try it](https://googlesamples.github.io/web-fundamentals/fundamentals/design-and-ux/input/touch/states-example.html) Internet Explorer on Windows Phone has a similar behavior, but is suppressed via a meta tag: `` Firefox has two side effects to handle. The `-moz-focus-inner` pseudo class, which adds an outline on touchable elements, you can remove by setting `border: 0`. If you are using a `