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.

            
              <h2>Simple 2D Transform Overlay Hover Animation </h2>
<div class="container">
	<div class="grid-1-of-3">

		<div class="box">
			<img src="http://www.greggant.com/emerge/codepen/helens.jpg">
			<div class="overlay">
				<div class="category">Mt Saint Helens</div>
				<h4>View from the Summit</h4>
			</div>
			<div class="hover">
				<div class="vert-center-outer">
					<div class="vert-center-inner">
						<a class="btn" href="http://www.oregonhikers.org/field_guide/Mount_Saint_Helens_Hike">More Info</a>
					</div>
				</div>
			</div>
		</div>
	</div>


            
          
!
            
              @mixin mrtransition($time) {
	-webkit-transition: all $time cubic-bezier(.25, .1, .25, 1);
	-moz-transition: all $time cubic-bezier(.25, .1, .25, 1);
	transition: all $time cubic-bezier(.25, .1, .25, 1);
}

.box {
	position: relative;
	margin-left: auto;
	margin-right: auto;
	overflow: hidden;
	color: white;
	max-width: 400px;
  img {
		width: 100%;
		max-width: 100%;
		@include mrtransition(1s);
	}
	&:hover img {
		-webkit-transform: scale(1.3);
	  -moz-transform: scale(1.3);
		-ms-transform: scale(1.3);
		transform: scale(1.3);
		@include mrtransition(4s);
	}
	.overlay {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		padding: 15px;
		padding-top: 0;
		padding-bottom: 0;
		background: #363636;
		@include mrtransition(.4s);
	}
	&:hover .overlay {
		opacity: 0;
	}
	.hover {
		padding: 10px;
		position: absolute;
		top: 0;
		width: 100%;
		height: 100%;
		opacity: 0;
		background: rgba(0, 0, 0, .5);
		@include mrtransition(.4s);
		text-align: center;
		&:hover {
			opacity: 1;
		}
	}
	.category {
		background-color: #8c8560;
		font-size: .75em;
		font-weight: 700;
		line-height: normal !important;
		position: relative;
		top: -15px;
		left: -15px;
		width: -webkit-calc(100% + 30px);
		width: -moz-calc(100% + 30px);
		width: calc(100% + 30px);
		padding: 3px 15px;
		background: #505050;
		@include mrtransition(.4s);
	}
	.btn {
		font-weight: 700;
		margin-top: 0;
		width: auto;
		cursor: pointer;
		font-size: 18px;
		display: inline-block;
	}
	.vert-center-outer {
		position: absolute;
		left: 0;
		top: 0;
	}
}

.btn {
	background-color: #8c8560;
  padding: 15px;
	color: white;
	text-decoration: none;
	&:visited {
		color: white;
	}
}
.vert-center-outer {
	display: table;
  width: 100%;
  height: 100%;
}
.vert-center-inner {
	display: table-cell;
  vertical-align: middle;
  position: relative;
  z-index: 10;
}
.grid-1-of-3 {

	padding: 10px;
}
body {
	height: 100%;
	min-height: 100vh;
	background: #356aa0; /* Old browsers */
background: -moz-linear-gradient(-45deg, #356aa0 0%, #356aa0 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, #356aa0 0%,#356aa0 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(135deg, #356aa0 0%,#356aa0 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
		-webkit-font-smoothing: antialiased; //whtie text fix
	-moz-osx-font-smoothing: grayscale;//whtie text fix
}
h1, h2 {
	color: white;
	padding-left: 15px;
	text-align: center;
}

            
          
!
999px
Loading ..................

Console