Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <div class="container">
	<div class="stewie-container">
		<div class="stewie">
			<div class="head">
				<div class="hair">
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
				</div>
				<div class="ear left"></div>
				<div class="ear right"></div>
				<div class="eyebrow left"></div>
				<div class="eyebrow right"></div>
				<div class="eye left">
					<div class="lid"></div>
				</div>
				<div class="eye right">
					<div class="lid"></div>
				</div>
				<div class="nose"></div>
				<div class="mouth"></div>
			</div>
			<div class="body">
				<div class="strap left">
					<div class="button"></div>
				</div>
				<div class="strap right">
					<div class="button"></div>
				</div>
				<div class="dungarees"></div>
			</div>
			<div class="arm right"></div>
			<div class="arm left"></div>
			<div class="arm-right"></div>
			<div class="armpit-right"></div>
			<div class="shoulder right"></div>
			<div class="shoulder left"></div>
			<div class="hand left">
				<div class="thumb"></div>
				<span></span>
				<span></span>
				<span></span>
			</div>
			<div class="hand right">
				<div class="thumb"></div>
				<span></span>
				<span></span>
				<span></span>
			</div>
			<div class="crotch"></div>
			<div class="leg left">
				<div class="trouser"></div>
				<div class="shoe"></div>
			</div>
			<div class="leg right">
				<div class="trouser"></div>
				<div class="shoe"></div>
			</div>
			<div class="shadow"></div>
		</div>
	</div>
</div>
<div class="logo">
	<img src="//upload.wikimedia.org/wikipedia/en/thumb/a/aa/Family_Guy_Logo.svg/200px-Family_Guy_Logo.svg.png">
	<h1>Stewie Griffin in Pure CSS</h1>
</div>
              
            
!

CSS

              
                @import "compass";

html, body {
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
}

body {
	background-color: #86c6f2;
	@include filter-gradient(#D0BDDA, #957DBA, horizontal);
	@include background-image(radial-gradient(center, ellipse cover, #D0BDDA 0%,#957DBA 100%));
}

.container {
	max-width: 600px;
	padding: 0 0;
	margin: 0 auto;
	min-height: 350px;
}

@mixin rotate($deg) {
	-ms-transform: rotate($deg);
	-webkit-transform: rotate($deg);
	transform: rotate($deg);
}

:before, :after {
	position: absolute;
	content: "";
	width: 0;
	height: 0;
}

$head-height: 90px;
$stewie-skin: #F7D6B7;
$stewie-width: 80px;
$stewie-height: 70px;
$stewie-border: #333333;
$stewie-yellow: #F8DB76;
$stewie-red: #C60844;

.stewie-container {
	position: absolute;
	height: 210px;
	width: $stewie-width;
	top: calc(48% - (210px / 2));
	left: calc(50% - (#{$stewie-width} / 2));
}

.stewie {
	position: relative;
	height: $stewie-height;
	width: $stewie-width;
	margin: $head-height auto 0 auto;
	
	* {
		position: absolute;
	}
	
	$head-width: 150px;
	
	.head {
		top: -($head-height - 5px);
		left: 50%;
		margin-left: -($head-width / 2);
		height: $head-height;
		width: $head-width;
		background: $stewie-skin;
		border: 1px solid $stewie-border;
		border-radius: 50% / 50%;
		@include rotate(-2deg);
		z-index: 5;
		
		$side-size: 30px;
		$side-position: -7px;
		$side-rotateZ: 46deg;
		$side-rotateY: 35deg;
		
		&:before,
		&:after {
			top: 50%;
			margin-top: -($side-size / 2);
			height: $side-size - 1;
			width: $side-size;
			background: $stewie-skin;
			border-bottom: 1px solid transparent;
			z-index: 6;
		}
		
		&:before {
			left: $side-position;
			border-top: 1px solid $stewie-border;
			border-left: 1px solid $stewie-border;
			border-right: 1px solid transparent;
			-webkit-transform: rotateY($side-rotateY) rotateZ(-$side-rotateZ);
			transform: rotateY($side-rotateY) rotateZ(-$side-rotateZ);
			border-radius: 16px 2px 0 2px;
		}
		
		&:after {
			right: $side-position;
			border-top: 1px solid $stewie-border;
			border-right: 1px solid $stewie-border;
			border-left: 1px solid transparent;
			-webkit-transform: rotateY($side-rotateY) rotateZ($side-rotateZ);
			transform: rotateY($side-rotateY) rotateZ($side-rotateZ);
			border-radius: 2px 16px 2px 0;
		}
		
		.hair span {
			height: 12px;
			width: 5px;
			border-top: 2px solid $stewie-border;
			border-right: 1px solid $stewie-border;
			border-bottom: 1px solid transparent;
			border-left: 1px solid transparent;
			margin-right: 10px;
			border-radius: 50%;
			@include rotate(-50deg);

			$hair-strands: 9;
			$hair-distance: 16.6px;
			$hair-startdistance: 5px;
			$hair-startrotate: -50deg;
			$hair-rotatediff: 8;

			@for $i from 1 through $hair-strands {
				&:nth-of-type(#{$i}n) {
					left: $hair-startdistance + ($hair-distance * ($i - 1));
					$hair-rotate: $hair-startrotate + ($hair-rotatediff * ($i - 1));
					@include rotate($hair-rotate);
				}
			}

			&:nth-of-type(1), &:nth-of-type(9) {
				top: 23px;
				height: 5px;
			}

			&:nth-of-type(2), &:nth-of-type(8) {
				top: 9px;
				height: 8px;
			}

			&:nth-of-type(3), &:nth-of-type(7) {
				top: 1px;
				height: 11px;
			}

			&:nth-of-type(4), &:nth-of-type(6) {
				top: -3px;
			}

			&:nth-of-type(5) {
				top: -4px;
			}
		}
		
		$ear-size: 10px;
		
		.ear {
			top: 40px;
			height: $ear-size;
			width: $ear-size;
			border-radius: 50%;
			background: $stewie-skin;
			border: 1px solid $stewie-border;
			z-index: 20;
			
			$ear-position: -10px;
			$ear-inner-position: 10%;
			$ear-inner-rotate: 30deg;
			
			&.left {
				left: $ear-position;
				border-right: 1px solid transparent;
				
				&:after {
					left: $ear-inner-position;
					@include rotate($ear-inner-rotate);
				}
			}
			
			&.right {
				right: $ear-position;
				border-left: 1px solid transparent;
				
				&:after {
					right: $ear-inner-position;
					@include rotate(-$ear-inner-rotate);
				}
			}
			
			$ear-inner-size: $ear-size / 2;
			
			&:after {
				top: 40%;
				height: $ear-inner-size;
				width: $ear-inner-size;
				border-radius: 50%;
				border-top: 1px solid $stewie-border;
				border-right: 1px solid transparent;
				border-left: 1px solid transparent;
			}
		}
		
		.eyebrow {
			top: 26px;
			width: 19px;
			border-top: 1px solid $stewie-border;
			
			$eyebrow-position: 28px;
			$eyebrow-rotate: 5deg;
			
			&.left {
				left: $eyebrow-position;
				$eyebrow-left-rotate: $eyebrow-rotate + 5;
				@include rotate(-$eyebrow-left-rotate);
			}
			
			&.right {
				right: $eyebrow-position;
				@include rotate($eyebrow-rotate);
			}
		}
		
		$eye-size: 28px;
		
		.eye {
			top: 32px;
			height: $eye-size;
			width: $eye-size;
			border: 1px solid $stewie-border;
			background: white;
			border-radius: 50%;
			overflow: hidden;
			z-index: 12;
			
			$eye-position: 24px;
			$lid-rotate: -2deg;
			$lid-position: -8px;
			
			&.left {
				left: $eye-position;
				
				.lid {
					@include rotate($lid-rotate);
				}
			}
			
			&.right {
				right: $eye-position;
				
				.lid {
					top: $lid-position - 1;
					@include rotate($lid-rotate);
				}
			}
			
			&:after {
				height: 4px;
				width: 4px;
				background: #333333;
				top: 40%;
				left: 60%;
				border-radius: 50%;
			}
			
			.lid {
				height: 15px;
				width: $eye-size;
				background: $stewie-skin;
				border-bottom: 1px solid $stewie-border;
				top: $lid-position;
				z-index: 9;
			}
		}
		
		$nose-rotateX: 20deg;
		$nose-rotateZ: -50deg;
		$nose-size: 8px;
		
		.nose {
			top: 55%;
			height: $nose-size - 3;
			width: $nose-size;
			background: $stewie-skin;
			left: 50%;
			margin-left: -($nose-size / 2);
			border-top: 1px solid $stewie-border;
			border-right: 1px solid $stewie-border;
			-webkit-transform: rotateX($nose-rotateX) rotateZ(-$nose-rotateZ);
			transform: rotateX($nose-rotateX) rotateZ(-$nose-rotateZ);
			border-radius: 0 20% 0 0;
		}
		
		.mouth {
			top: 58px;
			left: 42%;
			width: 22px;
			height: 10px;
			border-bottom: 1px solid $stewie-border;
			border-radius: 0 0 0 60%;
		
			$mouth-rotate: 40deg;
			$mouth-top-size: 5px;
			
			&:before, &:after {
				height: $mouth-top-size;
				border-right: 1px solid $stewie-border;
			}
			
			&:before {
				bottom: -1px;
				right: 1px;
				@include rotate(-$mouth-rotate);
			}
			
			&:after {
				height: $mouth-top-size - 1;
				bottom: -($mouth-top-size - 1);
				right: 4px;
				@include rotate($mouth-rotate);
			}
		}
	}
	
	.body {
		height: $stewie-height;
		width: $stewie-width - 2px;
		background: $stewie-yellow;
		border-radius: 30px / 80px;
		border: 1px solid $stewie-border;
		overflow: hidden;
		
		.dungarees {
			top: 25px;
			height: 80px;
			width: $stewie-width;
			background: $stewie-red;
			border: 1px solid $stewie-border;
			z-index: 2;
			@include rotate(-2deg);
		}
		
		$dungarees-top: -22px;
		
		&:before, &:after {
			top: $dungarees-top;
			height: 60px;
			width: 40px;
			border-radius: 50%;
			border-bottom: 1px solid $stewie-border;
			border-left: 1px solid transparent;
			border-right: 1px solid transparent;
			background: $stewie-yellow;
			z-index: 3;
		}
		
		$dungarees-position: -18px;
		
		&:before {
			left: $dungarees-position;
		}
		
		&:after {
			right: $dungarees-position - 2;
			top: $dungarees-top - 3px;
		}
		
		$strap-width: 8px;
		$strap-top: -3px;
		
		.strap {
			top: $strap-top;
			width: $strap-width;
			height: 33px;
			background: $stewie-red;
			border: 1px solid $stewie-border;
			border-radius: 20px;
			z-index: 4;
			@include rotate(-5deg);
			
			$strap-position: 16px;
			$button-position: -2px;
			
			&.left {
				left: $strap-position + 2px;
				
				.button {
					left: $button-position;
				}
			}
			
			&.right {
				right: $strap-position - 2px;
				top: $strap-top - 2px;
				
				.button {
					right: $button-position;
				}
			}
			
			$button-size: $strap-width + 2px;
			
			.button {
				height: $button-size;
				width: $button-size;
				background: #E4F265;
				border: 1px solid $stewie-border;
				border-radius: 50%;
				bottom: -2px;
				z-index: 5;
			}
		}
	}
	
	.shoulder {
		width: 10px;
		height: 32px;
		background: $stewie-yellow;
		z-index: 4;
		
		$shoulder-horizontal-position: -5px;
		$shoulder-vertical-position: 1px;
		$shoulder-rotate: 20deg;
		
		&.left {
			border-left: 1px solid $stewie-border;
			border-radius: 30px 0 0 0 / 120px;
			top: $shoulder-vertical-position;
			left: $shoulder-horizontal-position + 1;
			$shoulder-left-rotate: $shoulder-rotate - 5;
			@include rotate($shoulder-left-rotate);
		}
		
		&.right {
			border-right: 1px solid $stewie-border;
			border-radius: 0 50px 0 0 / 120px;
			top: $shoulder-vertical-position - 2;
			right: $shoulder-horizontal-position + 2;
			@include rotate(-$shoulder-rotate);
		}
	}
	
	.arm {
		width: 16px;
		height: 30px;
		border-left: 1px solid $stewie-border;
		border-right: 1px solid $stewie-border;
		border-bottom: 1px solid $stewie-border;
		border-top: 1px solid transparent;
		background: $stewie-yellow;
		z-index: -1;
		
		$arm-horizontal-position: -11px;
		$arm-vertical-position: 25px;
		$arm-rotate: 8deg;
		
		&.left {
			top: $arm-vertical-position;
			left: $arm-horizontal-position + 2;
			@include rotate($arm-rotate);
			border-radius: 20% 0 20% 20%;
			z-index: 10;
		}
		
		&.right {
			top: $arm-vertical-position - 2;
			right: $arm-horizontal-position + 2;
			@include rotate(-$arm-rotate);
			border-radius: 0 20% 40% 20% / 0 80% 80% 0;
		}
	}
	
	.arm-right {
		top: 31px;
		right: -5px;
		height: 23px;
		width: 8px;
		z-index: 10;
		background: $stewie-yellow;
		border-left: 1px solid $stewie-border;
		border-radius: 0 0 20px 0;
		@include rotate(-5deg);
	}
	
	.armpit-right {
		top: 18px;
		right: 5px;
		height: 16px;
		width: 5px;
		z-index: 10;
		background: $stewie-yellow;
		border-right: 1px solid $stewie-border;
		border-bottom: 1px solid transparent;
		border-radius: 40%;
		@include rotate(-12deg);
	}
	
	.hand {
		height: 15px;
		width: 13px;
		background: $stewie-skin;
		border: 1px solid $stewie-border;
		border-radius: 50%;
		
		$hand-horizontal-position: -10px;
		$hand-vertical-position: 6px;
		
		$fingers: 3;
		$fingers-difference: 3px;
		$fingers-rotate: 18deg;
		$finger-height: 5px;
		$thumb-vertical-position: -2px;
		$thumb-horizontal-position: 8px;
		$thumb-rotate: $fingers-rotate;
			
		&.left {
			bottom: $hand-vertical-position;
			left: $hand-horizontal-position;
			z-index: 5;
			
			span {
				@include rotate(-$fingers-rotate);
				border-radius: 9px 30px 20px 20px;
				
				@for $i from 1 through $fingers {
					&:nth-of-type(#{$i}n) {
						left: 1px + $fingers-difference * ($i - 1);
						height: $finger-height + $i;
					}
				}
			}
			
			.thumb {
				top: $thumb-horizontal-position;
				right: $thumb-vertical-position;
				@include rotate(-$thumb-rotate);
				z-index: 2;
			}
		}
			
		&.right {
			bottom: $hand-vertical-position + 2;
			right: $hand-horizontal-position + 2;
			z-index: -2;
			
			span {
				$fingers-right-rotate: $fingers-rotate + 10;
				@include rotate($fingers-right-rotate);
				border-radius: 30px 9px 20px 20px;
				
				@for $i from 1 through $fingers {
					&:nth-of-type(#{$i}n) {
						left: $fingers-difference * ($i - 1);
						height: $finger-height + ($i - 1);
					}
				}
			}
			
			.thumb {
				top: $thumb-horizontal-position - 1;
				right: $thumb-vertical-position + 4;
				$thumb-right-rotate: $thumb-rotate + 10;
				@include rotate($thumb-right-rotate);
				z-index: 4;
			}
		}
		
		span {
			top: 10px;
			width: 3px;
			background: $stewie-skin;
			border-left: 1px solid $stewie-border;
			border-bottom: 1px solid $stewie-border;
			border-right: 1px solid $stewie-border;
			border-top: 1px solid transparent;
			z-index: 3;
			display: block;
		}

		.thumb {
			height: 6px;
			width: 3px;
			border-radius: 50%;
			background: $stewie-skin;
			border: 1px solid $stewie-border;
			border-top: 1px solid transparent;
		}
	}
	
	.crotch {
		height: 18px;
		width: 8px;
		background: $stewie-red;
		border-bottom: 1px solid $stewie-border;
		border-right: 1px solid transparent;
		border-radius: 0 0 20px 0;
		z-index: 20;
		bottom: 0;
		left: calc(50% - 1px);
		z-index: 15;
	}
	
	$leg-height: 35px;
	$leg-width: 35px;
	$leg-position: 6px;
	
	$shoe-position: -12px;
	
	.leg {
		height: $leg-height;
		width: $leg-width;
		bottom: -$leg-height + 6px;
		left: $leg-position;
		
		&.left {
			z-index: 2;
			
			.trouser {
				height: $leg-height + 2px;
				border-radius: 0 10% 85% 40% / 0 50% 15% 15%;
			}
			
			.shoe {
				bottom: $shoe-position - 2;
			}
		}
		
		&.right {
			z-index: 1;
			left: $leg-position + ($leg-width - 2px);
			
			.trouser {
				border-radius: 0 10% 85% 40% / 0 50% 15% 15%;
			}
		}
		
		.trouser {
			height: $leg-height;
			width: $leg-width - 2px;
			background: $stewie-red;
			border-left: 1px solid $stewie-border;
			border-right: 1px solid $stewie-border;
			border-bottom: 1px solid $stewie-border;
			z-index: 10;
		}
		
		.shoe {
			height: 15px;
			width: $leg-width + 2px;
			background: #B2D0EB;
			left: 0;
			bottom: $shoe-position;
			border: 1px solid $stewie-border;
			border-radius: 50% 20px 30px 40px / 0 20px 10px 10px;
			@include rotate(6deg);
		}
	}
	
	$shadow-width: 100px;

	> .shadow {
		bottom: -20px;
		left: 40%;
		height: 0px;
		z-index: -1;
		width: 0;
		@include box-shadow( 0 -20px 40px 30px rgba(#000000, 0.5));
		@include transform(skewX(65deg));
	}
}

.logo {
	position: fixed;
	bottom: 15px;
	left: 15px;
	z-index: 20;
	
	img {
		margin: 0 0 0 -5px;
	}

	h1, h2 {
		font-family: "helvetica neue", helvetica, arial, sans-serif;
		margin: 0;
		font-size: 26px;
		letter-spacing: 1px;
		color: #FFFFFF;
		font-weight: 100;
	}
}

              
            
!

JS

              
                
              
            
!
999px

Console