How to remove empty line space in navigation menu?

it’s hard to answer without seeing the HTML and CSS, but from your description the behaviour is correct. If you don’t want the anchor tag to take up any visible room, you should give it a display:none. If you can edit the markup you could either add a class like this

<a href="#" class="hidden"></a>
with this css in your stylesheet:

.hidden {
  display: none;
}

or you could do an inline style (although not good practice)
<a href="#" style="display: none"></a>