Skip to content

Instantly share code, notes, and snippets.

@KirillTregubov
Last active August 6, 2025 00:44
Show Gist options
  • Save KirillTregubov/d7db4002b9097e47ea8e3cf822e25e5a to your computer and use it in GitHub Desktop.
Save KirillTregubov/d7db4002b9097e47ea8e3cf822e25e5a to your computer and use it in GitHub Desktop.
Tailwind utility for minimum WCAG AAA Target Size
/* More info: https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=If%20the%20target%20is%20the,44%20by%2044%20CSS%20pixels.&text=A%20footnote%20or%20an%20icon,from%20the%20minimum%20target%20size */
/* touch-hitbox or pointer-coarse:touch-hitbox (mobile-only) */
@utility touch-hitbox {
position: relative;
&:before {
content: "";
cursor: pointer;
position: absolute;
display: block;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
min-height: 44px;
min-width: 44px;
z-index: 9999;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment