Tagged “buttons”
Use CSS :has to set root-level styles based on a button’s state
Great tip here from Jhey. He advises using a button
with ARIA and a little JavaScript for your dark-mode toggle. And to apply the dark styles, use a CSS selector which targets the :root
parent of the button when in “pressed” state and sets a root-level custom property to “on”.
Perceived affordances and the functionality mismatch (by Léonie Watson)
Léonie tackles the prickly subject of “element re-purposing” in web development. This post follows a fantastic Twitter exchange started by Lea Verou regarding whether the common visual design request for “adjacent but mututally exclusive buttons” should be built as radio buttons or using <button>
elements.
Using one element or set of elements (usually because of their functionality) and styling them to look like something else is a common pattern […but…] it creates a mismatch between the actions people expect they can take and the ones they actually can.
Modern CSS Solutions
Modern CSS Solutions for Old CSS Problems
Block Links: A tricky UI Problem
You have a “card” component which includes a heading, some text, an image, and a link to the full article, and it’s working great. Then along comes a UX requirement that the full card (not just the button or link) should be clickable. This is where things get complicated.
Don’t set cursor: pointer on buttons
For many years I’ve been applying cursor: pointer
to buttons because it felt right and would improve the user experience.
See all tags.