"fixed while scrolling" forces the object to the front

When I create an object and then under constraints, I enable ‘Fix when scrolling’, then place another object over it which isn’t fixed, then run view mode, the fixed object is now in front of all scrolling objects. What am I doing wrong?

Hi! Fix when scrolling mimics the CSS behavior of position: fixed, which creates a new stacking context and therefore that layer is rendered above others.

What effect are you trying to achieve exactly in your prototype? Maybe there’s a workaround :slight_smile:

1 Like

Thanks for the reply. I never realized fixed elements automatically render on top. It looks like you can set position: relative to another element which will allow it to go over the fixed one. I don’t know if there’s a way to set relative positioning in Penpot, though.

I’m trying to create a fixed background image with a linear gradient over it. The gradient goes from transparent to black so when you scroll down the page, the background gradually disappears.