Demonstration on JS Bin
::before
pseudo-element on a span
is wrapping itself.
I solved it with white-space: nowrap
, but I recently saw a video that mentioned potential overflow issues with this approach. The video suggested an alternative solution, but in my JS Bin example, min-width: fit-content
doesn’t seem to work as expected in the video. While tinkering, I discovered that using float: left
resolved the issue (though I’m not too familiar with float
i wanted to say because for the purpose of the question). Could you explain why it isn’t working and share if there is any additional knowledge you have? Thank you for taking your time reading this.