Search code examples
htmlcssborder

Can you make "an invisible border"?


I'm trying to make a navbar as an exercise.

I'm using a:hover to include a solid border around the button being hovered. However, this makes all the other buttons move by the size of the border.

What is the proper fix to this problem? I know there are others (discussed here), I specifically tried to make the border "be invisible yet take up space even when not hovered". I set border:transparent hoping it might do what I want, but it did not show take space at all.

I know I could hand pick the border's color to be equal to the background and make it solid, but this is not what I want. Is there a sane way to solve this issue?


Solution

  • How about border: 10px solid transparent ?