Skip to content Skip to sidebar Skip to footer

New Line Between Anchors In Html Source Creates Empty Space In Browser

Possible Duplicate: How do I remove the visibility of spaces between inline elements? I usually format my source code to be easy read by humans, AFAIK browsers remove any \n\t c

Solution 1:

Anchors are inline elements. If you add a white-space (space, tab, newine, ..) between the elements, a gap will appear.

Depending on the situation, you can use either of the following methods to get rid of the gap:

  • Add a negative margin-left, e.g. margin-left:-4px;
  • Use float, e.g. float:left;
  • Remove the whitespace between the elements. To keep the code somewhat readable, you can break after the opening tag, eg:

    <ahref="..">Link</a><ahref="..">Link 2</a>

Post a Comment for "New Line Between Anchors In Html Source Creates Empty Space In Browser"