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="homer">
	<div class="comb-over">
			<div class="hair"></div>
			<div class="hair"></div>
		</div>
		<div class="skull"></div>
		<div class="face">
			<div class="brow"></div>
			<div class="left eye"></div>
			<div class="nose"></div>
			<div class="right eye"></div>
			<div class="mouth">
				<div class="smile"></div>
			</div>
		</div>
		<div class="m-hair"></div>
		<div class="ear">
			<div class="ear-inner"></div>
		</div>
	<div class="neck"></div>
</div>
              
            
!

CSS

              
                html {
	--skin-color: #fcdb00;
	--border-color: #000000;
	--beard-color: #beae7d;
	--eye-color: #ffffff;

	background: linear-gradient(
			-45deg,
			rgba(197, 222, 234, 1),
			rgba(138, 187, 215, 1) 31%,
			rgba(6, 109, 171, 1)
		) fixed;
	font-size: 75%;
}

body {
	display: flex;
	justify-content: center;
}

.homer {
	/* At some point in the past, I decided that everything should be in rem.
	   While this makes sense for layout-driven design, it's not very great
	   for illustrations like these. I tried to convert the values to pixels,
	   but the original scale was lost and the values are no longer
	   pixel-specific. */
	width: 17.5rem;
	position: relative;

	& div {
		/* The & here is needed to fix layout in Chrome/Edge as of version 116 */
		box-sizing: border-box;
		display: block;
		position: absolute;
	}
}

.comb-over {
	/* His comb over contains two hairs. This div controls the placement of the hairs on his head. */
	transform: rotate(-28deg);
	height: 3.7rem;
	left: 1.4rem;
	top: 0.4rem;
	width: 7.7rem;
	z-index: 50;

	.hair {
		border: 0.3rem solid var(--border-color);
		border-bottom: none;
		border-top-left-radius: 50% 100%;
		border-top-right-radius: 50% 100%;
		height: 2.7rem;
		width: 5.3rem;

		&:nth-child(2) {
			/* The second hair should be to the right and is slightly narrower. */
			left: 1.9rem;
			top: 0.7rem;
			width: 5.1rem;
		}

		/* Some browsers exhibit graphical artifacts when manipulating
		   objects with transforms, border, and positioning, so thin
		   pseudo-elements are placed on the bottom edge of the hairs
		   to obscure those potential lines. Since this behavior is
		   engine-specific, it's difficult to determine which browsers
		   are more likely to exhibit these artifacts. */
		&:first-child::before,
		&::after {
			background-color: var(--skin-color);
			bottom: -0.1rem;
			content: "";
			display: block;
			position: absolute;
		}

		/* The right side of the first hair should be perceived
		   as arching over the far side of his head. */
		&:first-child::before {
			height: 0.4rem;
			right: -0.3rem;
			transform: rotate(22deg);
			width: 0.5rem;
		}

		&::after {
			height: 0.2rem;
			left: 0;
			width: 100%;
		}
	}
}

.skull {
	width: 14rem;
	height: 14.2rem;

	top: 1.9rem;
	left: 0;
	z-index: 5;

	transform: rotate(-20deg);

	background-color: var(--skin-color);
	border: 0.3rem solid var(--border-color);
	border-bottom-color: var(--skin-color);
	border-top-left-radius: 6.8rem;
	border-top-right-radius: 6.8rem 6.6rem;
}

.face {
	top: 9rem;
	left: 4.6rem;
	z-index: 100;
}

.brow {
	width: 2.4rem;
	height: 2.6rem;

	left: 8.4rem;

	background-color: var(--skin-color);
	border: 0.3rem solid var(--border-color);
	border-width: 0.3rem 0.3rem 0 0;
	border-radius: 100%;
	border-top-left-radius: 0;

	&::after {
		content: "";

		display: block;
		width: 1.3rem;
		height: 1.5rem;

		position: absolute;
		top: -0.3rem;
		left: -0.3rem;

		background-color: var(--skin-color);
	}
}

.eye {
	top: 1.1rem;
	border: 0.3rem solid var(--border-color);

	&::after {
		content: "";
		display: block;

		position: absolute;
		z-index: 60;

		background-color: var(--border-color);
		border-radius: 100%;
	}

	&.left {
		width: 7.1rem;
		height: 6.7rem;

		z-index: 50;

		background-color: var(--eye-color);
		border-radius: 3.7rem 3.5rem 3.7rem 3.6rem / 3.5rem 3.3rem 3.5rem 3.5rem;

		&::after {
			width: 0.8rem;
			height: 0.8rem;

			top: 2.9rem;
			left: 1.7rem;
		}
	}

	&.right {
		width: 6.3rem;
		height: 6.3rem;

		left: 5.4rem;
		z-index: 45;

		background-color: var(--eye-color);
		border-radius: 100%;

		&::after {
			/* .eye.right::after */
			width: 0.8rem;
			height: 0.8rem;

			top: 2.7rem;
			left: 3rem;
		}
	}
}

.nose {
	width: 6.2rem;
	height: 3.1rem;

	top: 5.6rem;
	left: 4.4rem;
	z-index: 48;

	transform-origin: 0 100%;
	transform: rotate(-2deg);

	background-color: var(--skin-color);
	border: 0.3rem solid var(--border-color);
	border-left: 0;
	border-radius: 0 3rem 3rem 0;
}

.mouth {
	width: 7.9rem;
	height: 9.2rem;

	top: 8.3rem;
	left: 0.2rem;

	background-color: var(--beard-color);
	border: 0.3rem solid var(--border-color);
	border-radius: 5.8rem 0 3.6rem 4.8rem / 4.9rem 0 2.8rem 4.2rem;

	&::before,
	&::after {
		content: "";
		display: block;

		position: absolute;

		background-color: var(--beard-color);
		border: 0.3rem solid var(--border-color);
	}

	&::before {
		width: 1.6rem;
		height: 1.4rem;

		left: 7.3rem;
		bottom: 1.7rem;
		z-index: 5000;

		border-width: 0 0.3rem 0.3rem 0;
		border-bottom-right-radius: 1.6rem 1.5rem;
	}

	&::after {
		width: 4.2rem;
		height: 6.4rem;

		top: -1.7rem;
		left: 7.3rem;

		border-left: 0;
		border-radius: 0 4rem 4rem 0 / 0 4.5rem 1.5rem 0;
	}
}

.smile {
	width: 11rem;
	height: 3.3rem;

	top: 2.2rem;
	left: 1.3rem;
	z-index: 5000;

	background-color: var(--beard-color);
	border: 0.3rem solid var(--border-color);
	border-radius: 50%;

	&::before,
	&::after {
		content: "";
		display: block;
		position: absolute;
	}

	&::before {
		width: 10.2rem;
		height: 2rem;

		top: -0.3rem;
		left: -0.4rem;

		background-color: var(--beard-color);
	}

	&::after {
		height: 1.3rem;
		width: 2rem;

		top: 1.7rem;
		left: -0.4rem;

		transform: rotate(37deg);

		border-left: 0.3rem solid var(--border-color);
		border-radius: 0.4rem;
	}
}

.ear {
	width: 3.2rem;
	height: 3.2rem;

	top: 16.6rem;
	left: 1.3rem;
	z-index: 160;

	background-color: var(--skin-color);
	border: 0.3rem solid var(--border-color);
	border-radius: 100%;

	&::after {
		content: "";
		display: block;

		width: 1rem;
		height: 3.5rem;

		position: absolute;
		top: -0.2rem;
		right: -0.6rem;

		transform: rotate(-4deg);

		background-color: var(--skin-color);
	}
}

.ear-inner {
	display: block;

	width: 1.8rem;
	height: 1.8rem;

	position: absolute;
	top: 0.4rem;
	left: 0.4rem;

	transform: rotate(10deg);

	border-top: 0.3rem solid var(--border-color);
	border-radius: 100%;

	&::after {
		content: "";
		display: block;

		width: 1.2rem;
		height: 1.2rem;

		position: absolute;
		top: 0;
		left: 0.4rem;

		transform: rotate(25deg);

		border-left: 0.3rem solid var(--border-color);
		border-radius: 100%;
	}
}

.neck {
	width: 8.2rem;
	height: 13rem;

	top: 15rem;
	left: 2.6rem;

	transform: rotate(7deg);

	background-color: var(--skin-color);
	border: solid var(--border-color);
	border-width: 0 0.3rem;

	&::before {
		content: "";

		width: 7rem;
		height: 3rem;

		position: absolute;
		right: -1.4rem;
		bottom: 0;

		transform: rotate(7deg) skewX(20deg);

		background-color: var(--skin-color);
		border-right: 0.3rem solid var(--border-color);
	}
}

.m-hair {
	width: 2rem;
	height: 2.4rem;

	top: 14.7rem;
	left: 0.4rem;
	z-index: 100;

	transform: skewY(45deg);

	border: solid var(--border-color);
	border-width: 0.4rem 0 0 0.3rem;
	border-top-left-radius: 0.8rem;

	&::before {
		content: "";

		width: 2rem;
		height: 2.4rem;

		position: absolute;
		top: -2rem;
		left: 100%;

		transform: translate(-0.2rem, -0.4rem);

		border: solid var(--border-color);
		border-width: 0.4rem 0 0 0.3rem;
		border-top-left-radius: 0.8rem;
	}
}

              
            
!

JS

              
                
              
            
!
999px

Console