Can you make "an invisible border"?

ripper234 picture ripper234 · Apr 26, 2011 · Viewed 59.6k times · Source

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?

Answer

Phliplip picture Phliplip · Apr 26, 2011

How about border: 10px solid transparent ?