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 id="program2" class="window">
	<header>
		Program 2
	</header>
	<article>
		<p>I'm also a window, yay! You can move me around ;)</p>
		<a href="#" class="open">Open mission control from here</a>
	</article>
	<img src="https://cdn4.iconfinder.com/data/icons/REALVISTA/mobile/png/64/android_platform.png">
</div>

<div id="untitled" class="window">
	<header>
		<span>untitled</span>
	</header>
	<article>
		<h1>Mission Control in CSS</h1>
		<p>
			A simple demonstration of the Mac Mission Control in CSS. JavaScript is used to control when the effect is triggered or removed. Click <a href="#" class="open">here</a> to see it in action!
		</p>
		<br />
		<p>
			Made by <a href="http://migueljimenez.co" target="_blank">Miguel Jiménez</a> | 
			<a target="_blank" href="https://twitter.com/jachinte">@jachinte</a>
		</p>
		<p>You may also like <a href="https://codepen.io/jachinte/pen/OVeVEQ" target="_blank">Mac launchpad in CSS</a></p>
	</article>
	<img src="https://cdn1.iconfinder.com/data/icons/CrystalClear/64x64/apps/Startup-Wizard.png">
</div>

<div id="mission-control" class="hide">
	<nav>
		<a class="active close" data-program="untitled">
			<div>
				<img src="https://cdn1.iconfinder.com/data/icons/CrystalClear/64x64/apps/Startup-Wizard.png">
			</div>
			<span>untitled</span>
		</a>
		<a class="close" data-program="program2">
			<div>
				<img src="https://cdn4.iconfinder.com/data/icons/REALVISTA/mobile/png/64/android_platform.png">
			</div>
			<span>Program 2</span>
		</a>
	</nav>
</div>
<!-- https://www.iconfinder.com/icons/3586/hat_magic_wizard_icon#size=128 -->
            
          
!
            
              @blur: 30px;
@duration: .3s;
@icon-duration: .2s;
@radius: 4px;
@background: url(http://fairerplatform.com/wp-content/uploads/2014/06/os-x-10-10-yosemite-valley.jpg);

* { box-sizing: border-box; }
html, body { height: 100%; }

.yosemite-background {
	background: @background no-repeat center center fixed;
	background-size: cover;
}

body {
	.yosemite-background;
	font-family: "arial";
	font-size: 14px;
	margin: 0;
	padding: 0;
}

a {
	color: #DE2424;
	text-decoration: none;
}

h1 {
	font-size: 25px;
	font-weight: normal;
}

#mission-control {
	// counteracts the blurred edges
	background: #214765;
	bottom: 0;
	left: 0;
	opacity: 0;
	overflow: hidden;
	position: absolute;
	right: 0;
	transition: visibility 0s linear @duration,
		       	opacity @duration linear;
	top: 0;
	visibility: hidden;
	z-index: 1;
	
	&.show {
		opacity: 1;
		transition-delay: 0s;
		visibility: visible;
		
		&:before {
			.yosemite-background;
			bottom: 0;
			content: "";
			filter: blur(@blur);
			left: 0;
			position: absolute;
			right: 0;
			top: 0;
			z-index: -1;
		}
		
		nav {
			top: 0;
			transition-delay: 0s;
		}
	}
	
	&.hide {
		opacity: 0;
		visibility: hidden;
		
		nav {
			top: -180px;
		}
	}
	
	nav {
		background: rgba(0, 0, 0, 0.08);
		display: flex;
		justify-content: center;
		flex-wrap: nowrap;
		left: 0;
		position: absolute;
		right: 0;
		transition: top @duration linear;
		top: 0;
		
		a {
			cursor: pointer;
			display: inline-block;
			margin: 30px;
			text-align: center;
			
			&:active { opacity: 0.8; }
			&.active > div { border: 3px solid white; }
			
			> div {
				background: #333;
				border-radius: 2px;
				box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
				height: 80px;
				position: relative;
				text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
				width: 150px;
				
				> img {
					bottom: -10px;
					height: 32px;
					left: 50%;
					margin: 0 0 0 -16px;
					position: absolute;
					width: 32px;
				}
			}
			> span {
				color: white;
				display: block;
				font-size: 13px;
				margin-top: 20px;
			}
		}
	}
}

.window {
	border-radius: @radius;
	box-shadow: 0 0 50px 10px rgba(0, 0, 0, 0.6);
	perspective-origin: center bottom;
	position: relative;
	text-align: center;
	width: 768px;
	z-index: 2;
	
	header {
		background-color: #f2f2f2;
		background-image: linear-gradient(top, #f2f2f2 1%,#e8e8e8 100%);
		border-radius: @radius @radius 0 0;
		border-top: 1px solid white;
		border-bottom: 1px solid #ccc;
		color: #555;
		cursor: move;
		font-size: 13px;
		padding: 5px;
	}
	
	article {
		background: white;
		border-radius: 0 0 @radius @radius;
		color: #000;
		margin: 0;
		padding: 30px;
		
		p {
			line-height: 20px;
			padding: 0;
		}
	}
	
	> img {
		bottom: -32px;
		height: 64px;
		left: 50%;
		margin: 0 0 -24px -32px;
		opacity: 0;
		position: absolute;
		transition: visibility 0s linear @duration,
		       		opacity @duration linear,
					margin @duration ease-in;
		visibility: hidden;
		width: 64px;
	}
	
	&.zoomout {
		header { cursor: pointer; }
		img {
			margin: 0 0 0 -32px;
			opacity: 1;
			visibility: visible;
			transition-delay: 0s;
			z-index: 1;
		}
		
		&:before,
		&:after {
			bottom: 0;
			content: "";
			cursor: pointer;
			left: 0;
			position: absolute;
			right: 0;
			top: 0;
		}
		
		&:hover:after {
			border-radius: @radius;
			box-shadow: 0 0 15px 0 rgba(0, 123, 255, 1);
			z-index: 0;
		}
	}
	
	&.zoomin {
		img {
			margin: 0 0 -24px -32px;
			opacity: 0;
			visibility: hidden;
		}
	}
}

#untitled {
	left: 50%;
	margin: -100px 0 0 -400px;
	position: absolute;
	top: 50%;
}

#program2 {
	left: 40%;
	margin: -100px 0 0 -400px;
	position: absolute;
	top: 38%;
}

.zoomout {
	animation: zoomout @duration ease-in-out;
	transform: 	perspective(300px) 
				translate3d(0, 0, -60px);
}

.zoomin {
	animation: zoomin @duration ease-in-out;
	transform: 	perspective(0) 
				translate3d(0, 0, 0);
}

@keyframes zoomout {
	0% {
		transform: 	perspective(0) 
					translate3d(0, 0, 0);
	}
	100% {
		transform: 	perspective(300px) 
					translate3d(0, 0, -60px);
	}
}

@keyframes zoomin {
	0% {
		transform: 	perspective(300px) 
					translate3d(0, 0, -60px);
	}
	100% {
		transform: 	perspective(0) 
					translate3d(0, 0, 0);
	}
}
            
          
!
            
              var _window = $(".window"),
	missionControl = $("#mission-control");

function open() {
	missionControl.toggleClass("hide show");
	_window
		.addClass("zoomout")
		.draggable("disable");
}

function close() {
	_window
		.toggleClass("zoomout zoomin");
	missionControl.toggleClass("show hide");
		
	setTimeout(function() {
		_window
			.removeClass("zoomin")
			.draggable("enable");
	}, 300);
	
	var attr = $(this).attr("data-program");
	if (typeof attr !== typeof undefined && attr !== false) {
    	selectWindow($("#" + attr));
	}
}

function selectWindow(w) {
	var id = w.attr("id");
	$(".window:not(#" + id + ")").css("z-index", "2");
	w.css("z-index", "10");

	missionControl
		.find("a").removeClass("active");
	missionControl
		.find("a[data-program=" + id + "]").addClass("active");
}

$(".open").on("click", open);
$(".close").on("click", close);
$(".window").on("click", function() {
	selectWindow($(this));
});

// Close the launchpad when the content is clicked, only if the  target is not a link
$(document).mouseup(function (e) {
	if (missionControl.is(e.target) || _window.is(e.target)) {
		close();
	}
});

// Just because it's a window ;)
$(".window").draggable({ handle: "header" });
            
          
!
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