cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <!-- https://css-tricks.com/crop-top/ -->

<div class="page-wrap">
  <h1>Crop Top - Responsive Cropping</h1>
  <h2>Option One: background-image</h2>

    <div class="bg-image bg-image-wedding bg-center-bottom">
      The happy couple, front and center.
    <div class="bg-image bg-image-wedding bg-center-center">
      That's me in the middle.

    <div class="background">
      The "padding trick" thanks to Corey Worrell - height is not restrained, though.

</div> <!-- end .page-wrap -->
              .bg-image {
	/* image specified in seperate class  */
	height: 240px;
	width: 100%; }

.bg-image-wedding {
	background-image: url(http://parkerbennett.com/croptop/img/photo-wedding_1200x800.jpg);
	/* lt ie8 */
	-ms-background-position-x: center;
	-ms-background-position-y: bottom;
	/* default - may override with classes or media query */
	background-position: center bottom;
	/* scale bg image proportionately */
	background-size: cover;
	/* ie8 polyfill */
	-ms-behavior: url(backgroundsize.min.htc);
	/* prevent scaling past src width (or not) */
	/* max-width: 1200px; */ }

.bg-center-center {
	-ms-background-position-x: center;
	-ms-background-position-y: center;
	background-position: center center; }

/* the "padding trick" thanks to Corey Worrell */
.background {
    background-image: url(http://parkerbennett.com/croptop/img/photo-wedding_1200x800.jpg);
    background-position: center bottom;
	  /* scale bg image proportionately */
	  background-size: cover; /* or 100% */

/* example media query */
@media only screen and (min-width : 768px) {

	.bg-image { height: 320px; }

@media only screen and (min-width : 1200px) {

	.bg-image { height: 400px; }

/* presentational CSS below */

.page-wrap { 
  padding: .5em 2em 2em;}

h2 { 
  margin-top: -.5em; 
  font-style: italic; }

figure {
	margin: 2em 0; }

figcaption {
	margin: .5em 0;
	font-size: 85%;
	font-style: italic;
	color: #888; }

code {
  background: #fffe0;
  padding: 0 .25em; }

              <!-- CSS media query support for older IE - goes after CSS -->
  <!--[if lt IE 9]>

          <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.1.0/respond.min.js"></script>


<!-- another option: //css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js -->

Loading ..................