Created
August 5, 2015 06:38
-
-
Save cocolee/298e595a2e6fb6ae4054 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original CSS | |
.what-we-do-cards { | |
@include clearfix; | |
border-top: 10px solid rgba(255, 255, 255, .46); | |
background-color: white; | |
background: url('/img/front/strategy.jpg') no-repeat center center; | |
background-attachment: fixed; | |
background-size: cover; | |
color: $white; | |
padding-bottom: 4em; | |
} | |
GPU-friendly CSS | |
.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