DEV Community

Cover image for The Power of Precision in Code: Fixing the href attribute
Tim Lorent
Tim Lorent

Posted on

The Power of Precision in Code: Fixing the href attribute

It’s always the small things that trip you up.

Recently, I was working on a simple contact link in HTML:

<a href="tel:+31 6 123 45 678">Call me</a>
Enter fullscreen mode Exit fullscreen mode

Looks innocent enough, until the validator threw an error:

Error: Bad value 'tel:+31 6 123 45 678' for attribute href on element a: Illegal character in scheme data: space is not allowed.

Why It Happens

The tel: URI scheme is defined by RFC 3966. According to this standard, telephone URIs cannot contain spaces.

While the ITU-T E.123 standard recommends using spaces for readability in printed numbers, the URI version must use a continuous string of digits (and a leading + for international format).

Correct

<a href="tel:+31612345678">Call me</a>
Enter fullscreen mode Exit fullscreen mode

Incorrect

<a href="tel:+31 6 123 45 678">Call me</a>
Enter fullscreen mode Exit fullscreen mode

If you need to display a human-friendly version, separate the display text from the URI itself:

<a href="tel:+31612345678">+31 6 123 45 678</a>
Enter fullscreen mode Exit fullscreen mode

Why This Tiny Detail Matters

You might think: who cares? It’s just a space.

But this is where professional developers stand out. Attention to these “invisible” details reflects standards awareness, code discipline, and respect for reliability.

Here’s what these small wins teach you:

  • Validation errors are early warning systems.
  • Knowing the why behind specs makes you faster in the long run.
  • Clean, standard-compliant code means fewer surprises across browsers and devices.

The Bigger Lesson

Code quality isn’t built in big refactors or fancy frameworks, it’s built in tiny decisions like this one. The same mindset that fixes a URI space today is the one that prevents accessibility issues, race conditions, and security flaws tomorrow.

So the next time your validator complains, don’t dismiss it.

It’s not nitpicking: it’s mentorship in disguise.

What’s a “tiny” bug that once taught you a huge lesson?

Photo by Fotis Fotopoulos on Unsplash

Top comments (0)