Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Aren't you describing https://developer.mozilla.org/en-US/docs/Web/CSS/outline?

> Outline is a line outside of the element's border. Unlike other areas of the box, outlines don't take up space, so they don't affect the layout of the document in any way.

If you s/border/outline in the dev console on the image you get what you want.



Outline is used for :focus and :focus-visible, so box-shadow is nice to have for hover so you don't have to repurpose the outline for it.


Is there any directive against defining an outline for :hover?


No, but when tabbing it's often more usable to have the outline look the same across different types of elements, and having a separate focus style from hover style makes it easier.


it seems to me that :hover and :focus are doing the same job in this case - indicating the target of the next action. I don’t see this as “repurposing”.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: