Three cloths on Mrs. Lastri’s frame and a ring on cloth 2 when hovered or tabbed: border, outline or box-shadow, and the sizes the browser measures show which…
Why it matters
This choice decides whether a UI "jumps" on hover or focus. And the focus ring is the only guide for keyboard users: outline: none with no replacement leaves them lost, one of the most common accessibility bugs.
The key idea
border counts in the box, outline is painted outside it
Common mistakes
Keyboard users can no longer tell which button is focused That is outline: none added to "tidy up". Do not remove it, restyle it: :focus-visible { outline: 2px solid; outline-offset: 2px; }. If you use box-shadow, add outline: 2px solid transparent too so high-contrast mode still draws a ring.
The button jumps a little on every hoverborder is used for the hover highlight, so the box changes size and its neighbours move. Use outline or box-shadow, or give it a transparent border at rest so the room is already reserved.
Wanting a line on one side only with outlineoutline always surrounds the whole element; outline-bottom does not exist and the browser drops it. For one side use box-shadow: inset 0 -3px 0 colour (takes no room) or border-bottom with its room reserved.
Try it in this playground
Turn the highlight off, then on again With a border, cloth 3 and the price label jump; with outline or box-shadow they stay put.
Press Tab to the cloths That is a real :focus-visible, drawn the way you picked.
Move outline-offset, into the negatives too The ring moves away from the edge, or inside the cloth. offsetWidth stays the same.
Tick "A transparent border at rest" With a border, the highlight no longer moves anything: its room is reserved.