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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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

              
                .container
	.pumpkin-top
		.stem
		.cat
			.cat-eye.left
			.cat-eye.right
			.cat-nose
			.cat-arm.left
			.cat-arm.right
	.pumpkin
		.pumpkin-middle
			.shadow-small
			.shadow-small
			.shadow-small
			.shadow-small
		.pumpkin-bottom
		.eye.left
		.eye.right
		.nose
		.mouth
			.tooth-upper
			.tooth-upper
			.tooth-lower
			.tooth-lower
			.tooth-lower
	.platform
              
            
!

CSS

              
                $font-size: 20px; // Scale

// ===== Colors =====
$pumpkin: #e37b3b;
$pumpkinshadow: #e3631b;
$moutheyes: #1b0b1b;
$bgcolor: #7353c3;
$platform: #5f378f;
$stem: #4b9b7b;
$cat-color: #1b0b1b;
$cat-eyes: #fbbb13;
$cat-eyes-gloss: #4b2b4b;
$cat-details: #4b2b4b;

// ===== Mixins =====

@mixin absolute-horizontal-center {
	position: absolute;
	transform: translateX(-50%);
	left: 50%;
}

@mixin absolute-vertical-center {
	position: absolute;
	transform: translateY(-50%);
	top: 50%;
}

@mixin centerAbsolute() {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

@mixin circle($radius) {
	height: $radius;
	width: $radius;
	border-radius: 100%;
}

@mixin isosceles-triangle($height, $width, $color) {
	border-bottom: solid $height $color;
	border-left: solid ($width/2) transparent;
	border-right: solid ($width/2) transparent;
}

@mixin isosceles-triangle-upsidedown($height, $width, $color) {
	border-top: solid $height $color;
	border-left: solid ($width/2) transparent;
	border-right: solid ($width/2) transparent;
}

@mixin isosceles-triangle-pointed-right($height, $width, $color) {
	border-left: solid $height $color;
	border-top: solid ($width/2) transparent;
	border-bottom: solid ($width/2) transparent;
}

@mixin isosceles-triangle-pointed-left($height, $width, $color) {
	border-right: solid $height $color;
	border-top: solid ($width/2) transparent;
	border-bottom: solid ($width/2) transparent;
}

@mixin right-triangle($height, $width, $color) {
	border-bottom: solid $height $color;
	border-right: solid $width transparent;
}

@mixin right-triangle-pointed-left($height, $width, $color) {
	border-bottom: solid $height $color;
	border-left: solid $width transparent;
}

@mixin isosceles-trapezoid($height, $topwidth, $btmwidth, $color) {
	width: $topwidth;
	$sideCutWidth: ($btmwidth - $topwidth) / 2;
	border-bottom: solid $height $color;
	border-left: solid $sideCutWidth transparent;
	border-right: solid $sideCutWidth transparent;
}

// Styles to extend

.pseudo {
	content: '';
	position: absolute;
}

// Those little rounded shadow details
.little-shadow {
	background: $pumpkinshadow;
	width: 0.4em;
	border-radius: 0.2em;
}

// ===== Styling =====

body {
	background: $bgcolor;
	font-size: $font-size;
}

.container {
	border: 1px solid black;
	height: 15em;
	width: 15em;
	@include centerAbsolute;
	top: 70%;
	//@include absolute-horizontal-center;
}

.pumpkin, .pumpkin-top, .stem, .platform {
	@include absolute-horizontal-center;
}

.pumpkin-top {
	background: $pumpkin;
	height: 2.5em;
	width: 10.8em;
	border-radius: 2.5em 2.5em 0 0;
	top: -7em; // Max height
	
	box-shadow: inset -2.5em 0em 0 0 $pumpkinshadow;
	
	// border: 1px solid red; // REMOVE
	
	// Little shadow details
	&:before, &:after {
		@extend .pseudo;
		@extend .little-shadow;
	}
	
	&:before {
		height: 0.9em;
		top: 1em;
		left: 1.7em;
	}
	
	&:after {
		height: 1em;
		border-radius: 0.2em 0.2em 0em 0em;
		top: 1.505em;
		left: 4.2em;
	}
	
	// TODO: ANIMATE!
	animation-name: raise-top;
	//animation-duration: 4s;
	
	.stem {
		background: $stem;
		height: 1.2em;
		width: 1em;
		top: -1.2em;
	}
}

// --- Cat ---
// Inside the .pumpkin-top

.cat {
	@include absolute-horizontal-center;
	top: 2.5em;
	height: 7em;
	width: 7.5em;
	background: $cat-color;
	
	// Ears
	&:before, &:after {
		@extend .pseudo;
		background: inherit;
		height: 1.3em;
		width: 1.25em;
		top: 0;
	}
	
	// Left ear
	&:before {
		left: -1.25em;
		border-radius: 1.15em 0 0 0;
	}
	
	// Right ear
	&:after {
		right: -1.25em;
		border-radius: 0 1.15em 0 0;
	}
}

.cat-eye {
	@include circle(2em);
	background: $cat-eyes;
	position: absolute;
	top: 1.2em;
	
	&.left { left: 0.5em; }
	&.right { right: 0.5em; }
	
	&:before {
		@extend .pseudo;
		@include circle(1.5em);
		@include centerAbsolute();
		background: $cat-color;
	}
}
// Arm width: 1.5em
// TODO arms
.cat-arm {
	background: inherit;
	height: 2.5em;
	width: 1.4em;
	border-radius: 0 0 0.7em  0.7em;
	
	// TODO: Move this to be part of the pumpkin (middle part)
	// because stacking is not working right. Alternatively figure
	// out the z-index situation
	&.left {
		left: 0;
		//top: 7em;
		top: 6em;
		position: absolute;
		//z-index: ;
		background: red;
		// 3.6 em / 2 = 1.8em
		height: 1.8em;
	}
	
	&.right {
		
	}
	
}

// --- Pumpkin ---

.pumpkin {
	bottom: 0.6em;
	height: 11.9em;
	width: 11.8em;
	position: absolute;
	bottom: 0.6em;
	// So the angled shadow doesn't disturb the pumpkin
	// shape when the top is lifted
	overflow: hidden; 
}

.pumpkin-middle {
	//z-index: 1;
	
	@include isosceles-trapezoid(9.7em, 10.8em, 11.8em, $pumpkin);
	position: absolute;
	//background: linear-gradient(217deg, rgba(255,0,0,.8), rgba(255,0,0,0) 70.71%);
	
	// Shadow on the side of the pumpkin
	&:before {
		@extend .pseudo;
		transform: rotate(-2.97deg);
		top: -0.07em;
		right: -0.275em;
		height: 9.9em;
		width: 2.5em;
		
		background: $pumpkinshadow;
		//background: blue;
	}
	
	// Non-shadow area around the right eye
	&:after {
		@extend .pseudo;
		background: $pumpkin;
		top: 2.5em;
		right: 1.1em;
		height: 4.4em;
		width: 1.25em;
		border-radius: 1em 0.35em 0.35em 0;
	}
	
	// Little shadows
	.shadow-small {
		@extend .little-shadow;
		position: absolute;
		
		&:nth-of-type(1) {
			border-radius: 0em 0em 0.2em 0.2em;
			height: 1.95em;
			top: 0em;
			left: 4.2em;
			
			&:before {
				@extend .pseudo;
				@extend .little-shadow;
				height: 0.55em;
				bottom: -0.75em;
			}
		}
		
		&:nth-of-type(2) {
			height: 1.7em;
			top: 6.1em;
			left: 0.4em;
			
			&:before {
				@extend .pseudo;
				@extend .little-shadow;
				height: 0.55em;
				bottom: -0.75em;
			}
		}
		
		&:nth-of-type(3) {
			height: 1.35em;
			top: 1.6em;
			left: 6.35em;
			
			&:before {
				@extend .pseudo;
				@extend .little-shadow;
				height: 0.45em;
				top: -0.65em;
			}
		}
		
		&:nth-of-type(4) {
			background: $pumpkin;
			height: 1.2em;
			left: 9.75em;
			top: 8.05em;
		}
	}
	
	
	
}
	
.pumpkin-bottom {
	background: $pumpkin;
	height: 2.2em;
	width: 11.8em;
	position: absolute;
	bottom: 0;
	border-radius: 0 0 18% 18% / 0 0 90% 90%;
	
	// Shadow
	box-shadow: inset -2.5em 0em 0 0 $pumpkinshadow;
	
	// Tiny detail shadow
	&:before {
		@extend .pseudo;
		@extend .little-shadow;
		height: 0.8em;
		bottom: -0.2em;
		left: 3.7em;
	}
}

// ------- Facial features -------

.eye {
	position: absolute;
	top: 3.75em;
	
	// Iris
	&:before {
		@extend .pseudo;
		height: 0.5em;
		width: 1em;
		border-radius: 1em 1em 0 0;
		background: $pumpkin;
		bottom: -2.5em;
	}
	
	// Eyebrows
	&:after {
		@extend .pseudo;
		background: $pumpkinshadow;
		height: 3.5em;
		width: 0.6em;
		border-radius: 0.3em;
	}
	
	// Left eye
	&.left {
		@include right-triangle(2.5em, 2.5em, $moutheyes);
		left: 2.2em;
		
		&:before { left: 0.45em; } // Iris
		
		// Left eyebrow
		&:after {
			left: 1em;
			bottom: -1.8em;
			transform: rotate(-45deg);
		}
	}
	
	&.right {
		@include right-triangle-pointed-left(2.5em, 2.5em, $moutheyes);
		right: 2.2em;
		
		&:before { right: 0.45em; } // Iris
		
		// Right eyebrow
		&:after {
			//background: transparent; // TODO
			height: 4.0em;
			right: 0.8em;
			bottom: -1.7em;
			transform: rotate(45deg);
		}
	}
	
}

.nose {
	@include isosceles-triangle(1em, 1em, $moutheyes);
	@include absolute-horizontal-center;
	bottom: 5.65em;
}

.mouth {
	width: 7.5em;
	height: 3em;
	background: $moutheyes;
	border-radius: 0 0 30% 30% / 0 0 75% 75%;
	@include absolute-horizontal-center;
	bottom: 2em;
}

.tooth-upper {
	position: absolute;
	@include isosceles-triangle-upsidedown(1.3em, 1.4em, $pumpkin);
	
	&:nth-of-type(1) { left: 1.7em; }
	&:nth-of-type(2) { left: 4.25em; }
}

.tooth-lower {
	position: absolute;
	bottom: 0em;
	@include isosceles-triangle(1em, 1.2em, $pumpkin);
	
	&:nth-of-type(3) { left: 1.8em; }
	&:nth-of-type(4) { left: 3.05em; }
	&:nth-of-type(5) { left: 4.35em; }
}

.platform {
	height: 0.6em;
	width: 90%;
	position: absolute;
	bottom: 0;
	background: $platform;
	border-radius: 0.3em;
}



// ===== Animations =====

@keyframes raise-top {
	0% {
		top: 0;
	}
	
	50% {
		top: -8.5em;
	}
}
              
            
!

JS

              
                // ¯\_(ツ)_/¯
              
            
!
999px

Console