<div id="footer">
<p><a href="link.html">Link</a>
<a href="link.html">Link</a></p>
</div>

Result: LinkLink

If I add a space in between <a href="link.html">Link and </a></p>

Result: Link Link

Dani AI

Generated

Brief answer: browsers collapse source whitespace, so two adjacent inline elements written with no space produce "LinkLink" — that is what saw. is correct that inserting whitespace or using an HTML non‑breaking space will create visible separation, and that CSS margins/padding also solve it. Each approach has tradeoffs: an HTML space inside an anchor becomes part of the clickable text; a non‑breaking space prevents wrapping; CSS keeps behavior and accessibility separate from content.

Practical options (prefer CSS for maintainability):

  • Use inline-block on the links and give them right margin. This creates non‑clickable gaps and is reliable across layouts.
#footer a {
  display: inline-block;
  margin-right: 0.5rem;
}
#footer a:last-child {
  margin-right: 0;
}
  • Use a flex container and the CSS gap property for consistent spacing without extra markup.
#footer p {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

Notes and cautions: avoid sprinkling non‑semantic spacing entities if the links are a navigation set — use a semantic list (ul/li) or a nav container and style it. Non‑breaking spaces prevent line breaks on small screens. If vertical alignment looks off after switching to inline‑block, adjust vertical-align or use flexbox. For reference on the gap property and anchor semantics, see MDN: gap and a (HTML element).

<div id="footer">
<p><a href="link.html">Link</a> &nbsp;
<a href="link.html">Link</a></p>
</div>
<!-- or -->
<a href="link.html">Link</a> <a href="link.html">Link</a></p>

both give Link Link
everything inside <a></a> is link,
if you want spaces that arent underlined and clickable add them outside the <a></a> tags,

&nbsp; = html 'hardspace' non-break space

or you can add margins & padding to your links in css

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.