Skip to content

Instantly share code, notes, and snippets.

@digitalhitler
Created September 1, 2017 17:37
Show Gist options
  • Save digitalhitler/31bf5a7f6baf50829c413ddabdb0bd99 to your computer and use it in GitHub Desktop.
Save digitalhitler/31bf5a7f6baf50829c413ddabdb0bd99 to your computer and use it in GitHub Desktop.
Blurred glass SCSS
html {
background-image: url("http://placekitten.com/1920/1120");
background-position: center bottom;
background-attachment: fixed;
background-size: cover;
height: 100%;
font-size: 100%;
}
body {
margin: 0;
}
.glass {
position: relative;
padding: 10px 0;
border-bottom: 1px solid;
border-bottom-color: #ccc;
border-bottom-color: rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.2);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
height: 180px;
}
.glass::before {
position: absolute;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
background-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20width%3D%221920%22%20height%3D%221120%22%3E%3Cdefs%3E%3Cfilter%20id%3D%22blur%22%3E%3CfeGaussianBlur%20stdDeviation%3D%225%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cimage%20xlink%3Ahref%3D%22http%3A%2F%2Fplacekitten.com%2F1920%2F1120%22%20width%3D%221920%22%20height%3D%221120%22%20filter%3D%22url%28%23blur%29%22%2F%3E%3C%2Fsvg%3E"), url("http://placekitten.com/1920/1120");
background-position: center bottom;
background-attachment: fixed;
background-size: cover;
content: "";
filter: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%3E%3Cdefs%3E%3Cfilter%20id%3D%22blur%22%3E%3CfeGaussianBlur%20stdDeviation%3D%225%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3C%2Fsvg%3E#blur");
-webkit-filter: blur(25px);
filter: blur(25px);
overflow: hidden;
}
.glass .legacy-ie-fix {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #fff;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=20)";
}
@media only screen {
.glass h1 {
-ms-filter: "none";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment