I'm trying to use this snippet (link with original code) : https://codepen.io/starkxx/pen/NdemEv
here is the snippet edited with some content (a container for the POC, removed some code) :
https://codepen.io/Demky/pen/EzNLVB
I don't find a solution to contain the stem-wrapper inside his new parent's height; I think the problem is from this block of code but I can't find the solution
<div class="stem-wrapper">
<div class="stem"></div>
<div class="stem-background"></div>
</div>
the fixed stem-wrapper alway take the full windows height or disapear if I try to give him a position:absolute/relative/...
.stem-wrapper {
position: fixed;
top: 0px;
bottom: 0px;
left: 50%;
}
I'm not allowed to put a static value for 'top' as I don't know how far from the top the snippet will be
what I tried :
- I tried to build a parent so I could use position:relative on the parent and add position:absolute on the child as I have seen here : https://stackoverflow.com/a/20994123/9552861 but I failled to make it works
- tried to play with position/container, in vain
- I also tried to play with the javascript but I made no progress
Can you people give me tips on how to find the solution ?
Is it sure the problem is from the CSS ?
Should I keep trying to translate this fixed element to a parent(position:relative) / Child(position:absolute) relation; or am I not looking in the right direction ?
Please let me know if I need to add more informations on my question. I let the css/html code on codepen for better visibility but I can paste it here if it's better for readers.
Screenshot of the problem:
Screenshot of the problem when I export the snippet to another website (the stem- take the whole page)
Edit : Tried to make the problem easier to understand;
In the modified snippet (this link from top ) :
I added a container (#timelineContainer with background-color:yellow );
I expect the ".steam-wrapper" and his childs (.stem, .stem-background) to not go outside of the yellow area (updated the screenshot with the right color).
The goal is to contain this POC/Snippet to a container so it can works outside of this sandbox without taking the full page's height