An Invisible Space

/

The home page of this blog contains a list of posts. For each post, there's a line with its date and title separated by a one-ex gap. The gap is not highlighted when selected, but copying it results in a space. This is how I did it:

<time>2026-01-08</time><span style="display:inline-block;width:1ex">
</span><a href="space.html">An Invisible Space</a>

I only tested it on Firefox, and I'm not sure why it works. I think the space is hidden because it's in a block formatting context, noting that display:block does the same.

Before arriving at this approach, I tried having the space at the end of the <time> (which gets the styles), but then it does get highlighted when selected, like, on some websites, the space at the end of each paragraph. (With an extra space, the <time> would have an invalid datetime value anyway.) Another attempt is to put it at the start of the <a>, in which case the title fails to wrap correctly when the screen is not wide enough.