DEV Community

Cover image for Removing trailing space underlines from groups of anchor tags

Removing trailing space underlines from groups of anchor tags

Cassidy Williams on June 15, 2023

Recently as I was working on some styles for my blog, I ran into an issue where I had a block of anchor tags rendered in JSX, and they didn't look ...
Collapse
 
sallychenyx9 profile image
Sally Chen

i've definitely ran into this before - didn't know that display: inline-block fixes it! thanks for sharing!

Collapse
 
philipjohnbasile profile image
Philip John Basile

Neat!!

Collapse
 
mrleblanc101 profile image
Sébastien LeBlanc • Edited

That has nothing to do with JSX, you clearly have whitespace between your word and the end tag (the newline).

If you don't want the whitespace, don't add one ? 😅

<a class="tag" href={`#`}>#{tag}</a>

Collapse
 
z0al profile image
z0al

Thank you for sharing.

Was the trailing space part the link label? Or is it due to JSX somehow? I didn't fully understand that that part.

Collapse
 
cassidoo profile image
Cassidy Williams • Edited

It was due to JSX somehow 🙃
I ended up controlling the spacing a bit differently like this:
github.com/cassidoo/blahg/blob/mai...