Skip to content

Instantly share code, notes, and snippets.

Created January 23, 2015 02:27
Show Gist options
  • Save anonymous/f478ee437b18f4795d6a to your computer and use it in GitHub Desktop.
Save anonymous/f478ee437b18f4795d6a to your computer and use it in GitHub Desktop.
object-fit
<h1><a href="//developer.mozilla.org/en-US/docs/Web/CSS/object-fit">object-fit</a></h1>
<h2>(original image)</h2>
<img src="//goo.gl/njQhWF" alt="Pier">
<h2>fill</h2>
<img class="object-fit_fill" src="//goo.gl/njQhWF" alt="Pier">
<h2>contain</h2>
<img class="object-fit_contain" src="//goo.gl/njQhWF" alt="Pier">
<h2>cover</h2>
<img class="object-fit_cover" src="//goo.gl/njQhWF" alt="Pier">
<h2>none</h2>
<img class="object-fit_none" src="//goo.gl/njQhWF" alt="Pier">
<h2>scale-down</h2>
<img class="object-fit_scale-down" src="//goo.gl/njQhWF" alt="Pier">
html, a { color: #333 }
html { font-family: "Open Sans", sans-serif }
a { text-decoration: none }
h1 { font-weight: 300 }
h2 { font-weight: 600 }
img { height: 150px; background-color: #ddd }
img[class] { width: 150px }
.object-fit_fill { object-fit: fill }
.object-fit_contain { object-fit: contain }
.object-fit_cover { object-fit: cover }
.object-fit_none { object-fit: none }
.object-fit_scale-down { object-fit: scale-down }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment