How do I close the gap between elements if I hide a few of them with visibility: hidden?
I have this HTML.
<div id="logged_in" style="display:inline; visibility: hidden;"><a onclick=""></a> • </div>
<a id="login_box" onclick="show_login_user();">Login</a>
<a id="logout_box" onclick="logout_user();" style="visibility: hidden;">Logout</a> |
<a onclick="show_register_user();">Register</a> |
When the user is logged out, logout is hidden and there is a gap between login and register. If the user is logged in, there is a gap between the logged_in username and logout.
Use
display:none;instead.visibility:hidden;does not “free” the space used by the hidden element.