I'm having a problem with positioning the floating sticky element on the right side with other elements not being impacted. As you can see in the image below, there are multiple "I'm full width I'm full width I'm full width..." elements. First few are shrunk in width due to a sticky element being positioned on the right side. However, the width of all the elements below are not impacted by the sticky element.
I want ALL elements to have the full width, and have the sticky element on the right side.
Here's an example with the explained issue: https://codesandbox.io/s/late-night-d7f4jv?file=/index.html
I have a solution for you but it is not the best...
I have moved your
<h2>content into a separate<div>and changed the position to being absolute. This allows the content to spread without restrictions from the DOM. I used z-index to ensure the sticky element would stay at the front of the page and changed from using float values to just applying amargin-left: auto.Not the most elegant solution...