Making a transition responsive
I've been using a background transition for a hover effect on links. It works all right, but it breaks off from each line when the text breaks into multiple lines.
How can I make it stick to one line? Here's the attached codepen.
https://codepen.io/lofty-brambles/pen/jOKVvMY
11 Replies
you don't want the text to breakline?
add
white-space: no-wrap
but then it will make the body wider than the screen
or you want the effect only on the first line?
Could I make the effect extend to multiple lines, when the line breaks
Sorry for the delay, kinda lost connection.
yea, change the inset to
inset: 0
and it can be even easier in that case
Ah, as in, I wanted the background to be split into many pieces across the lines themselves
ah like so... hmm. have to think about that one. not sure
I first thought of spans and putting an effect on them, but trying to connect the effects up after that seems to be a hassle.
you can use <mark> but the effect will be slightly different, it will break the gradient into the lines
Actually, that's perfect, thanks!
np, yw
I was just realizing. Don't use <mark>. It will give importance to the text (screenreaders)
ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark
a span with display: flow-content is better
hmm... I see..
interesting
I do need importance as it's being used as the heading of the latest article, so I'll keep it in mind!