Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created December 26, 2011 20:41
Show Gist options
  • Save LeaVerou/1522085 to your computer and use it in GitHub Desktop.
Save LeaVerou/1522085 to your computer and use it in GitHub Desktop.
Frosted glass effect with filters
/**
* Frosted glass effect with filters
*/
* { padding: 0; margin: 0 }
body, html { min-height: 100%; }
body, div:after {
background: url('http://devslovebacon.com/images/bacon-bg.jpg') center;
}
div {
position: absolute;
top: 50%; left: 50%;
width: 400px; height: 300px;
margin: -150px 0 0 -200px;
padding: 1em;
border: 1px solid rgba(255,255,255,.5);
border-radius: 10px;
box-sizing: border-box;
background: rgba(255,255,255,.2);
font: 150%/1.6 sans-serif;
text-align: center;
box-shadow: -1px -1px 10px rgba(255,255,255,.3) inset,
2px 2px 20px rgba(0,0,0,.5);
text-shadow: 0 1px 1px rgba(255,255,255,.6);
}
div:after {
content: '';
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
z-index: -1;
border-radius:inherit;
-webkit-filter: blur(3px);
}
<div>This is an overlay.
The background behind this overlay <strong>only</strong>
should be blurred on Webkit nightlies. </div>
{"view":"split-vertical","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment