I was thinking about something I wrote yesterday when I was talking about styling underlines on links:
For a start, you can adjust the distance of the underline from the text using
text-underline-offset. If you’re using a generous line-height, use a generous distance here too.
For some reason, I completely forgot that we’ve got a line-height unit in CSS now: lh. So if you want to make the distance of your underline proportional to the line height of the text that the link is part of, it’s easy-peasy:
text-underline-offset: 0.15lh;
The greater the line height, the greater the distance between the link text and its underline.
I think this one is going into my collection of CSS snippets I use on almost every project.
# Shared by Schalk Neethling on Thursday, August 14th, 2025 at 8:34am
# Shared by Jules 🍺 on Thursday, August 14th, 2025 at 10:49am
# Shared by zeldman on Thursday, August 14th, 2025 at 4:36pm
# Shared by Sue on Thursday, August 14th, 2025 at 8:53pm
# Shared by Antoine on Thursday, August 21st, 2025 at 8:01am