Skip to content

Instantly share code, notes, and snippets.

@xto3na
Created July 2, 2015 17:58
Show Gist options
  • Save xto3na/39fc29d7f998c370a40f to your computer and use it in GitHub Desktop.
Save xto3na/39fc29d7f998c370a40f to your computer and use it in GitHub Desktop.
Optimization for background-attachment: fixed;
.what-we-do-cards {
@include clearfix;
border-top: 10px solid rgba(255, 255, 255, .46);
color: $white;
padding-bottom: 4em;
overflow: hidden; // added for pseudo-element
position: relative; // added for pseudo-element
// Fixed-position background image
&::before {
content: ' ';
position: fixed; // instead of background-attachment
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: white;
background: url('/img/front/strategy.jpg') no-repeat center center;
background-size: cover;
will-change: transform; // creates a new paint layer
z-index: -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment