Make element sticky relative to parent?

Hi there, I have a <code> element displaying some content with a floating label to copy the text next to it. Sometimes, the content inside gets too long and have set a width limit and allow for horizontal scrolling. The problem is when this happens the floating label does not stick to the right corner of the element in in the way that I hoped. It should be fairly obvious what I mean with an example: https://codepen.io/D10f/pen/RwmpRjN What I'd like to do is make the label stick to the corner even after scrolling horizontally. But I've been at it for a while and I'm not sure how to get it done. Any help is welcome 🙂 Thanks!
2 Replies
Joao
Joao•2mo ago
Hi, sorry for the delay. Thanks for sharing that it works nicely 😄