Only in Safari – position:fixed child cut off when parent is position:fixed and overflow:hidden

I found a solution that’s working for me in Safari 13.0.2 on macOS Catalina 10.15.

The trick was to split position: fixed and overflow: hidden across two divs, like so:

<div class="wrapper">
  <div class="wrap2">
    <div class="inner">
        Great success in safari 13.0.2 on MacOS Catalina 10.15       
    </div>
  </div>
</div>
.wrapper{
    background-color: red;
    padding: 40px;
    width: 200px;
    height: 400px;
    position: fixed;
    top: 0;
    left: 0;
}

.wrap2{
  background-color: yellow;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

.inner{
    background-color: silver;
    padding: 20px;
    width: 400px;
    height: 200px;
    position: fixed !important;
    top: 50px;
    left: 40px;
}

And a JS fiddle: https://jsfiddle.net/jxmallett/gsyb326v/1/

Edit: Confirmed this works in Safari on iOS 12.3.1 on an iPad.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)