JSFiddle - React, Tailwind, and code Playground

Blurry Image Thing

by Jennifer Perrin

HTML

<h1>Blurry Image Thing</h1>
<p>CSS blur isn't great, especially for images. Browser support is bad, transitions don't look great, and the edges are kind of funky. But eventually they'll be super rad.</p>

<div class="container cf">
  <div class="blurImage">
    <img src="http://placekitten.com/600/700" />
    <div class="blurImage__copy">
      <h3>Kitty Kat</h3>
      <p>He's a Cat, this is him.</p>
    </div>
  </div>
  <div class="blurImage">
    <img src="http://placekitten.com/600/880" />
    <div class="blurImage__copy">
      <h3>Here is a Picture of a Cat With a Long Title</h3>
      <p>Here's what a cat looks like</p>
    </div>
  </div>
  <div class="blurImage">
    <img src="http://placekitten.com/500/600" />
    <div class="blurImage__copy">
      <h3>Row Kittens</h3>
      <p>This is a different pic. This looks ok with multiple lines too.</p>
    </div>
  </div>
</div>

CSS

@import url(http://fonts.googleapis.com/css?family=Open+Sans:300|Oswald:400,700,300);
.blurImage {
  position: relative;
  width: 29%;
  height: 0;
  margin: 0 2%;
  padding-bottom: 29%;
  background: black;
  float: left;
  overflow: hidden;
  box-shadow: 0 0 0 10px #c04830;
}
.blurImage:hover img {
  width: 120%;
  opacity: 1;
  -webkit-filter: blur(0) grayscale(0);
}
.blurImage:hover .blurImage__copy {
  -webkit-filter: blur(10px);
  opacity: 0;
}
.blurImage img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110%;
  opacity: 0.5;
  -webkit-filter: blur(5px) grayscale(1);
  transform: translate(-50%, -50%);
  transition: all 0.25s;
}

.blurImage__copy {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  text-align: center;
  font-size: 0.75em;
  transform: translate(-50%, -50%);
  transition: all 0.25s;
}

/** GLOBAL STYLES **/
* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
}

html {
  font-size: 62.5%;
}

body {
  background: #cc4d33;
  font-family: 'Open Sans', sans-serif;
  font-size: 2em;
  line-height: 1.5;
  color: white;
  -webkit-transform: rotateY(0deg);
}

body > p {
  width: 50%;
  margin: 0 auto;
  text-align: center;
}

h1 {
  font-family: 'Oswald', sans-serif;
  font-weight: 400;
  text-align: center;
  text-transform: uppercase;
}

h3 {
  font-family: 'Oswald';
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
}

.container {
  width: 90%;
  max-width: 900px;
  margin: 1.5em auto;
}

.cf:before,
.cf:after {
  content: " ";
  display: table;
}

.cf:after {
  clear: both;
}

.cf {
  *zoom: 1;
}