css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="collage-container">
	<div class="collage">
		<div class="collage-item">
			<div class="collage-item-image"></div>
		</div>
		<div class="collage-item">
			<div class="collage-item-image"></div>
		</div>
		<div class="collage-item">
			<div class="collage-item-image"></div>
		</div>
		<div class="collage-item">
			<div class="collage-item-image"></div>
		</div>
		<div class="collage-hero">
			<div class="collage-hero-image"></div>
		</div>
		<div class="collage-hover-overlay"></div>
	</div>
</div>	
            
          
!
            
              // Variables =============================================================
$font-family: "Open Sans", Helvetica, Arial, sans-serif

// Mixins ================================================================
=absolute($top, $left, $right, $bottom)
	position: absolute
	top: $top
	left: $left
	right: $right
	bottom: $bottom

=translate($x,$y)
	-webkit-transform: translate($x,$y)
	-webkit-transform: translate3d($x,$y,0)
	-ms-transform: translate($x,$y)
	-ms-transform: translate3d($x,$y,0)
	transform: translate($x,$y)
	transform: translate3d($x,$y,0)

// Colors ================================================================
// Boomer Colors
$boom: #330066
$boom-dk: darken($boom, 2%)
$boom-lt: #9966CC

// Font Colors
$font-dark: #333

// Base colors
$grey: #BDC4D0
$background-light: #F3F4F8
$background-dark: #2F3032
$border-light: darken($background-light, 2%)
$border-dark: darken($background-dark, 2%)
$primary-color: #004983

// Base ==================================================================
*:not(i)
	font-family: $font-family

*
	box-sizing: border-box

html
	height: 100%
	font-size: 16px

body
	display: flex
	flex:
		direction: column
	justify-content: center
	align-items: center
	height: 100%
	background: 
		color: darken($background-light, 12%)
		image: radial-gradient(ellipse at center, $background-light 30%, darken($background-light, 12%) 100%)

	
// Styles ===============================================================

.collage-container
	display: block
	flex:
		basis: auto
	// justify-content: center
	// align-items: center
	position: relative
	width: 75%
	max-width: 1000px
	margin: 0 auto

	&:before
		content: ''
		display: block
		width: 100%
		padding-top: 66.666667%
	
.collage
	display: flex
	flex:
		direction: row
		wrap: wrap
	+absolute(0,0,0,0)
	width: 100%
	height: 100%
	padding: 0.5%
	background: white
	box-shadow: 0 6px 80px -4px rgba(0,0,0,0.1)
	cursor: pointer

	// Pseudo -------
	&:after
		content: ''
		display: block
		+absolute(null,50%,null,-25px)
		width: 60%
		height: 10px
		background: transparent
		border-radius: 50%
		box-shadow: 0 50px 36px rgba(0,0,0,0.30)
		transform: translate(-50%,0)

	.collage-item
		display: flex
		flex:
			direction: column
			grow: 1
			shrink: 0
			basis: 50%
		position: relative
		width: 50%
		height: 50%
		padding: 0.5%
		
		&:first-child
			.collage-item-image
				background-image: url('http://lorempixel.com/400/300/city')
				transform-origin: left top

		&:nth-child(2)
			.collage-item-image
				background-image: url('http://lorempixel.com/400/300/nightlife')
				transform-origin: right top

		&:nth-child(3)
			.collage-item-image
				background-image: url('http://lorempixel.com/400/300/people')
				transform-origin: left bottom	

		&:nth-child(4)
			.collage-item-image
				background-image: url('http://lorempixel.com/400/300/')
				transform-origin: right bottom	
	
		&:hover
			.collage-item-image
				transform: scale(2.022)
				transform: scale3d(2.022, 2.028,1)
				transition: transform 0.4s 0.2s cubic-bezier(0.65, 0.05, 0.36, 1), z-index 0.4s 0.2s
				z-index: 999	
		
			& ~ .collage-hover-overlay
				visibility: visible
				transition: visibility 0.4s 0.2s, opacity 0.4s 0.2s
				opacity: 1
	
		.collage-item-image
			flex:
				basis: 100%
			width: 100%
			background: 
				size: cover
				position: center center
			transition: transform 0.5s, z-index 0.4s
			will-change: transform, opacity, z-index
			z-index: 1
			
	.collage-hero
		+absolute(50%,50%,null,null)
		+translate(-50%,-50%)
		width: 33.333333%
		height: 50%
		padding: 1%
		background: white
		border-radius: 100%
		transition: transform 0.5s, z-index 0.4s
		z-index: 10
	
		&:hover
			.collage-hero-image
				border-radius: 0%
				transform: scale(2.065)
				transition: transform 0.4s 0.2s, border-radius 0.6s 0.2s, z-index 0.4s 0.2s
				z-index: 999	
		
			& ~ .collage-hover-overlay
				visibility: visible
				transition: visibility 0.4s 0.2s, opacity 0.4s 0.2s
				opacity: 1	
	
		.collage-hero-image
			width: 100%
			height: 100%
			background: 
				image: url('https://hd.unsplash.com/photo-1470897655254-05feb2d2ab97')
				size: cover
				position: center center	
			border-radius: 100%
			transition: transform 0.5s, border-radius 0.7s 0.3s, z-index 0.4s
			will-change: transform, opacity, border-radius, z-index	
			z-index: 1
	
	
	.collage-hover-overlay
		visibility: hidden
		+absolute(0,0,0,0)
		background: white
		will-change: visibility, opacity
		opacity: 0
		transition: visibility 0.5s, opacity 0.5s
		z-index: 5
		
            
          
!
            
              $( document ).ready(function() {
	var width = $('.collage').width();
	// var padding = width * 0.005;
	// $(this).css('box-shadow', '10px 10px 5px #888');
	
	
	$(window).resize(function(){
		var collage = $('.collage');
		var collageItem = $('.collage-item');
		var width = collage.width();
		var padding = width * 0.005;
		// collage.css('box-shadow', 'inset 0 0 0 ' + padding + 'px ' + 'green');
		// collageItem.css('box-shadow', 'inset 0 0 0 ' + padding + 'px ' + 'blue');

	});
});	
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console