Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              <!-- /////////////////////////////////
3D Canvas Mockup by Nick McBurney
www.nickmcburney.co.uk
//////////////////////////////////////
Change options using CSS panel to change image URL, frame type (wrap, white, black) and frame depth.
//////////////////////////////////////
Ensure you enter canvas size in the correct aspect ratio which the original image uses. 
--------------------------------------
E.g. 2000x1000px image would fit canvas with ratio of 2:1 such as: 200x100px, 500x250px, 760x380px
////////////////////////////////// -->
<div class="canvas-frame">
	<div class="canvas black">
		<div class="top"></div>
		<div class="right"></div>
	</div>
	<div class="canvas black">
		<div class="top"></div>
		<div class="right"></div>
	</div>
	<div class="canvas black">
		<div class="top"></div>
		<div class="right"></div>
	</div>
</div>

            
          
!

CSS

            
              // OPTIONS
////////////////////////////////////
// CSS variables
:root {
--imageURL: url(https://unsplash.it/480/220);
--width: 480px;
--height: 220px;
--imageWidth: 480px;
--imageHeight: 220px;

--panelCount: 3;
--panelWidth: calc(var(--imageWidth)/var(--panelCount));
--panelHeight: var(--imageHeight);
--panelBgPosition1: calc(100% / var(--panelCount));
--panelBgPosition2: calc((100% / var(--panelCount) * 2));
--panelBgPosition3: calc((100% / var(--panelCount) * 3));

--canvasDepth: 8px;
--canvasSpacing: 32px;
--frameWidth: calc(var(--imageWidth) + (var(--canvasSpacing) * 1.5));
}



// MIXINS
////////////////////////////////////
// mixin for psudeo elements
@mixin psudeo(){
	display: block;
	content: "";
	position: absolute;
}

// mixin for right frame
@mixin rightFrame(){
	transform: scaleX(-1) skew(0, 45deg);
	transform-origin: 0% 50%;
	margin-left: var(--canvasDepth);
	margin-top: calc(-1 * var(--canvasDepth));
	left: 100%;
	
	// include background image and apply shadow
	@include backgroundImage(100%, 0);
	&:after {
		@include psudeo();
		position: absolute;
		width: var(--canvasDepth);
		height: var(--panelHeight);
		background: rgba(#000, 0.38);
	}
}

// mixin for top frame styles
@mixin topFrame(){
	transform: scaleY(-1) skew(45deg, 0);
	transform-origin: 0% 50%;
	margin-left: calc(var(--canvasDepth)/2);
	// using calc -1 to convert the variable to a negative
	// e.g. 10px => -10px
	top: calc(-1 * var(--canvasDepth));
	
	// include background image and apply shadow
	@include backgroundImage(top, left);
	// shadow
	&:after {
		@include psudeo();
		position: absolute;
		width: var(--panelWidth);
		height: var(--canvasDepth);
		background: rgba(#000, 0.25);
	}
}

// mixin for background-image settings
@mixin backgroundImage($position_x, $position_y){
	background-image: var(--imageURL);
	background-size: var(--width) var(--height);
	background-position: $position_x $position_y;
}



// STYLES
////////////////////////////////////
body, html {
	width: 100%;
	height: 100%;
	margin: auto;
	background: #f1f1f1;
}

.canvas-frame {
	position: relative;
	display: flex;
	flex-wrap: no-wrap;
	justify-content: center;
	align-items: center;
	height: 100%;
	max-width: var(--frameWidth);
	margin: auto;
	
	> div {
		flex-grow: 0;
		flex-shrink: 0;
	}
}

.canvas {
	@include backgroundImage(50%, 100%);
	margin: auto;
	position: relative;
	width: var(--panelWidth);
	height: var(--panelHeight);
	box-shadow: 5px 0px 25px 3px #000;
	// top frame
	.top {
		@include psudeo();
		@include topFrame();
		@include backgroundImage(50%, 0);
		width: var(--panelWidth);
		height: var(--canvasDepth);
		
	}
	// right frame
	.right {
		@include psudeo();
		@include rightFrame();
		@include backgroundImage(var(--panelBgPosition2), 0);
		width: var(--canvasDepth);
		height: var(--panelHeight);
		
	}
	&:first-of-type {
		background-position: 0 0;
		.right {
			@include backgroundImage(var(--panelBgPosition1), 0);
		}
		.top {
			@include backgroundImage(0, 0);
		}
	}
	&:last-of-type {
		background-position: var(--panelBgPosition3) 0;
		.right {
			@include backgroundImage(var(--panelBgPosition3), 0);
		}
		.top {
			@include backgroundImage(100%, 0);
		}
	}
}
            
          
!

JS

            
              // No JavaScript Required :) 
            
          
!
999px

Console