Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Forked from anonymous/A blurred overlay.markdown
Created September 18, 2015 02:29
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CodeMyUI/ede01df34d017a2f0d2d to your computer and use it in GitHub Desktop.
Save CodeMyUI/ede01df34d017a2f0d2d to your computer and use it in GitHub Desktop.
A blurred overlay

A blurred overlay

... mask or whatever that is responsive and could be cross-browser compatible back to IE9

A Pen by Glenn Reyes on CodePen.

License.

<link href='https://fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'>
<div class="container">
<div class="overlay">
<h1>A blurred overlay</h1>
<p>... mask or whatever<br>that is responsive and could be cross-browser compatible back to IE9</p>
</div>
</div>
html, body, .container {
width: 100%;
height: 100%;
}
.container,
.overlay:before {
background: url(https://unsplash.it/1920/1080/?random) no-repeat fixed 0 0 / cover;
}
.container {
align-items: center;
display: flex;
justify-content: center;
}
.overlay {
max-height: 200px;
margin: 0 auto;
max-width: 768px;
overflow: hidden;
padding: 50px;
position: relative;
color: white;
font-family: 'Lato';
position: relative;
text-align: center;
z-index: 0;
&:before {
content: '';
filter: blur(20px);
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: -1;
}
}
@afonsoalban
Copy link

for .overlay::before you could set "140%" for width and height and "-20%" for top and left properties, and get a strong effect near the edges

(https://cloud.githubusercontent.com/assets/1678210/10057029/95eefd34-6214-11e5-8552-bd8cd8587525.png)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment