Sticky positioned flex element only obeys mix-blend-mode in row direction

4 days ago 9
ARTICLE AD BOX

I have two flex displayed divs on my site, each containing two child divs with a flex-direction set to row and a mix-blend-mode set to multiply, visible against an image background.
This works fine.

The second of these parent divs is a footer positioned as sticky.

Below a specific @media breaking point, here at 500px, the flex components have their flex-direction set to column.

Once the sticky footer element has the column direction set, the mix-blend-mode stops working, and the background becomes the simple opaque background-color.

The change can be seen by decreasing the size of the window of the code snippet below.

Why does this happen, and what can I do to fix this?


I'm not entirely certain the 'stickiness' has anything to do with it, but because that's the only real difference between the two parent divs, I'm pretty sure that must be the culprit.

The only somewhat relevant similar question found is mix-blend-mode with table cell that have position sticky, having to do with dimensions/positioning rather than mix-blend-mode, but nevertheless notably and possibly importantly points out that a sticky element changes states from 'relative' to 'static' once it reaches its threshold. In both these states mix-blend-mode should work, however. The change in state itself is also not causing it, since the blend mode will happily reactivate once the contents are displayed in a row (or my understanding is flawed, which is very likely).

body{ background-image:url('https://i.sstatic.net/yuEE0.jpg'); background-repeat: no-repeat; background-position: center; background-size:cover; min-height:90vh; } .footer,.main{ display:flex; flex-direction:row; justify-content:space-between; align-items:center; width:90%; flex-direction:column; } .footer{ position:sticky; top:50%; } .blue_bg{ position:relative; height:fit-content; padding:2em; } .blue_bg:before{ content: ""; position: absolute; top: 0; right: 0; left: 0; bottom: 0; background-color:rgba(24, 86, 143); mix-blend-mode: multiply; border-radius:20px; z-index:0; } .blue_bg span{ position:relative; color:#fff; z-index:2; } @media only screen and (min-width: 500px) { .footer,.main{ flex-direction:row; } .footer{ position:absolute; } } <body> <div class="content"> <div class="main"> <div class="blue_bg"><span>To whom shall I hire myself out?</span></div> <div class="blue_bg"><span>What beast should I adore?</span></div> </div> <div class="footer"> <div class="blue_bg"><span>What lies shall I uphold?</span></div> <div class="blue_bg"><span>In what blood tread?</span></div> </div> </div> </body>
Read Entire Article