<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://web.dev/</id>
  <title>Patrick H. Lauke on web.dev</title>
  <updated>2026-04-15T23:21:06Z</updated>
  <author>
    <name>Patrick H. Lauke</name>
  </author>
  <link href="https://web.dev/authors/patrickhlauke/feed.xml" rel="self"/>
  <link href="https://web.dev/"/>
  <icon>https://web-dev.imgix.net/image/admin/1v5F1SOBl46ZghbHQMle.svg</icon>
  <logo>https://web.dev/images/shared/rss-banner.png</logo>
  <subtitle>Patrick is a Web Evangelist</subtitle>
  
  
  <entry>
    <title>Accessible tap targets</title>
    <link href="https://web.dev/accessible-tap-targets/"/>
    <updated>2020-03-31T00:00:00Z</updated>
    <id>https://web.dev/accessible-tap-targets/</id>
    <content type="html" mode="escaped">&lt;p&gt;When your design is displayed on a mobile device,
you should ensure that interactive elements like buttons or links are large enough,
and have enough space around them,
to make them easy to press without accidentally overlapping onto other elements.
This benefits all users,
but is especially helpful for anyone with a motor impairment.&lt;/p&gt;
&lt;p&gt;A minimum recommended touch target size is around 48 device independent pixels
on a site with a properly set mobile viewport.
For example, while an icon may only have a width and height of 24px,
you can use additional padding to bring the tap target size up to 48px.
The 48x48 pixel area corresponds to around 9mm,
which is about the size of a person&#39;s finger pad area.&lt;/p&gt;
&lt;p&gt;In the demo, I have added padding to all of the links in order to make sure they meet the minimum size.&lt;/p&gt;
&lt;div class=&quot;glitch-embed-wrap&quot; style=&quot;height: 420px; width: 100%;&quot;&gt;
  &lt;iframe allow=&quot;camera; clipboard-read; clipboard-write; encrypted-media; geolocation; microphone; midi&quot; loading=&quot;lazy&quot; src=&quot;https://glitch.com/embed/#!/embed/tap-targets?attributionHidden=true&amp;sidebarCollapsed=true&amp;path=index.html&amp;previewSize=100&quot; style=&quot;height: 100%; width: 100%; border: 0;&quot; title=&quot;tap-targets on Glitch&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;p&gt;Touch targets should also be spaced about 8 pixels apart,
both horizontally and vertically,
so that a user&#39;s finger pressing on one tap target does not inadvertently touch another tap target.&lt;/p&gt;
&lt;h2 id=&quot;testing-your-touch-targets&quot;&gt;Testing your touch targets &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/accessible-tap-targets/#testing-your-touch-targets&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If your target is text and you have used relative values such as &lt;code&gt;em&lt;/code&gt; or &lt;code&gt;rem&lt;/code&gt; to size the text and any padding,
you can use DevTools to check that the computed value of that area is large enough.
In the example below I am using &lt;code&gt;em&lt;/code&gt; for my text and padding.&lt;/p&gt;
&lt;div class=&quot;glitch-embed-wrap&quot; style=&quot;height: 420px; width: 100%;&quot;&gt;
  &lt;iframe allow=&quot;camera; clipboard-read; clipboard-write; encrypted-media; geolocation; microphone; midi&quot; loading=&quot;lazy&quot; src=&quot;https://glitch.com/embed/#!/embed/tap-targets-2?attributionHidden=true&amp;sidebarCollapsed=true&amp;path=style.css&amp;previewSize=100&quot; style=&quot;height: 100%; width: 100%; border: 0;&quot; title=&quot;tap-targets-2 on Glitch&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;p&gt;Inspect the &lt;code&gt;a&lt;/code&gt; of the link,
and in Chrome DevTools switch to the &lt;a href=&quot;https://developer.chrome.com/docs/devtools/css/overrides/#computed&quot; rel=&quot;noopener&quot;&gt;Computed pane&lt;/a&gt;  where you can inspect the various parts of the box
and see what pixel size they resolve to.
In Firefox DevTools there is a Layout Panel.
In that Panel you get the actual size of the inspected element.&lt;/p&gt;
&lt;figure style=&quot;max-width: 500px&quot;&gt;
  &lt;img alt=&quot;The Layout Panel in Firefox DevTools showing the size of the a element&quot; decoding=&quot;async&quot; height=&quot;565&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/admin/vmFzREveRttHVDfLqqCx.jpg?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;using-media-queries-to-detect-touchscreen-use&quot;&gt;Using media queries to detect touchscreen use &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/accessible-tap-targets/#using-media-queries-to-detect-touchscreen-use&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Instead of simply testing for viewport dimensions, and then guessing
that small dimensions are likely to be phones or tablets, which in turn
use a touchscreen, there are now more robust ways to adapt
your design based on actual device capabilities.&lt;/p&gt;
&lt;p&gt;One of the media features we can now test for with media queries
is whether the user&#39;s &lt;em&gt;primary input&lt;/em&gt; is a touchscreen (&lt;code&gt;pointer&lt;/code&gt;) and
whether &lt;em&gt;any&lt;/em&gt; of the currently detected inputs is a touchscreen (&lt;code&gt;any-pointer&lt;/code&gt;).
The &lt;code&gt;pointer&lt;/code&gt; and &lt;code&gt;any-pointer&lt;/code&gt; features will return &lt;code&gt;fine&lt;/code&gt; or &lt;code&gt;coarse&lt;/code&gt;.
A fine pointer will be someone using a mouse or trackpad,
even if that mouse is connected via Bluetooth to a phone.
A &lt;code&gt;coarse&lt;/code&gt; pointer indicates a touchscreen,
which could be a mobile device but may also be a laptop screen or large tablet.&lt;/p&gt;
&lt;p&gt;If you are adjusting your CSS within a media query to increase the touch target,
testing for a coarse pointer allows you to increase the tap targets for all touchscreen users.
This gives the larger tap area whether the device is a phone or larger device.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.container a&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; .2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;any-pointer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; coarse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;.container a&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; .8em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;You can find out more about interaction media features such as pointer
in the &lt;a href=&quot;https://web.dev/responsive-web-design-basics/&quot;&gt;Responsive web design basics&lt;/a&gt; article.&lt;/p&gt;
</content>
    <author>
      <name>Dave Gash</name>
    </author><author>
      <name>Meggin Kearney</name>
    </author><author>
      <name>Rachel Andrew</name>
    </author><author>
      <name>Rob Dodson</name>
    </author><author>
      <name>Patrick H. Lauke</name>
    </author>
  </entry>
</feed>
