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.

            
              <h1>CSS Faces</h1>
<div class="container girl">
	<div class="rachelface">
		<span class="bow"></span>
		<span class="hair">
			<span class="right-side-fringe"></span>
		</span>
		<span class="ears"></span>
		<header>
			<span class="eyes"></span>
			<span class="nose"></span>
			<span class="blush"></span>
			<span class="mouth"></span>
		</header>
	</div>
</div>

<div class="container boy">
	<div class="jonface">
		<span class="hair"></span>
		<span class="ears"></span>
		<header>
			<span class="eyes"></span>
			<span class="nose"></span>
			<span class="blush"></span>
			<span class="beard"></span>
			<span class="mouth"></span>
		</header>
	</div>
</div>

<div class="container girl">
	<div class="hayleyface">
		<span class="hair">
			<span class="full-fringe"></span>
		</span>
		<span class="ears"></span>
		<header>
			<span class="eyes"></span>
			<span class="nose"></span>
			<span class="blush"></span>
			<span class="mouth"></span>
		</header>
	</div>
</div>

<div class="container girl">
	<div class="enitaface">
		<span class="hair">
		</span>
		<span class="ears"></span>
		<header>
			<span class="eyes"></span>
			<span class="nose"></span>
			<span class="blush"></span>
			<span class="mouth"></span>
		</header>
	</div>
</div>
            
          
!
            
              $face__position: 50%;
$face__spacing: 100% / $face__position;

$face--width: 94px;
$face--height: 110px;

.container {
	position: relative;
	border-radius: 10px;
	height: 200px;
	width: 100px;
	padding: 20px;
	float: left;
}

@mixin face {
	position: absolute;
	top: 45%;
	left: $face__position;
	width: $face--width;
	height: $face--height;
	margin-top: calc(-#{$face--height} / #{$face__spacing});
	margin-left: calc(-#{$face--width} / #{$face__spacing});
}

/* ---- z-index ---- */
$ears-index: 10;
$secondary-hair-index: $ears-index + 5;
$fringe-index: $secondary-hair-index + 5;

@mixin standard($person-skin-color, $person-hair-color, $person-ears-size, $person-blush-color) {
	/* -------------------------------------------

		Default CSS Variables (Standard face) */

		$skin--color: $person-skin-color;
		$hair--color: $person-hair-color;

		$face__features--color: #171717;
		$face__eyes--position: 11px;
		$face__nose--width: 5px;
		$face__mouth--width: 45px;
		$face__mouth--size: 2px;
		$face__blush--position: 15px;
		$face__blush--color: $person-blush-color;

		$ears--width: $person-ears-size;
		$ears--radius--outer: $person-ears-size * 2;
		$ears--radius--inner: $person-ears-size;

	/* ------------------------------------------- */

	header {
		@include face;
		background: $skin--color;
		overflow: hidden;

		.eyes {
			position: absolute;
			top: 37%;
			left: $face__position;

			&:before,
			&:after {
				content: "";
				position: absolute;
				top: 0;
				width: 0;
				height: 0;
				border: 6px solid $face__features--color;
				border-radius: 10px;
			}

			&:before {
				left: $face__eyes--position;
			}

			&:after {
				right: $face__eyes--position;
			}
		}

		.nose {
			position: absolute;
			top: 53%;
			left: $face__position;
			height: 10px;
			width: $face__nose--width;
			margin-left: calc(-#{$face__nose--width} / #{$face__spacing});
			border: 2px solid $face__features--color;
			border-color: transparent transparent $face__features--color $face__features--color;
			border-radius: 0 10px 10px;
			-webkit-transform: rotate(9deg);
			-moz-transform: rotate(9deg);
			-o-transform: rotate(9deg);
			-ms-transform: rotate(9deg);
			transform: rotate(9deg);
		}

		.mouth {
			position: absolute;
			top: 42%;
			left: $face__position;
			width: $face__mouth--width;
			height: 40px;
			margin-left: calc((-#{$face__mouth--width} + -#{$face__mouth--size}) / #{$face__spacing});
			border: $face__mouth--size solid $face__features--color;
			border-radius: 20px;
			border-color: transparent transparent $face__features--color transparent;
		}

		.blush {
			position: absolute;
			top: 55%;
			left: $face__position;
			height: 50px;
			width: $face--width;
			margin-left: calc(-#{$face--width} / #{$face__spacing});

			&:before,
			&:after {
				-moz-box-shadow: 0 0 15px 8px rgba($face__blush--color ,0.6);
				-webkit-box-shadow: 0 0 15px 8px rgba($face__blush--color ,0.6);
				box-shadow: 0 0 15px 8px rgba($face__blush--color ,0.6);
				content: "";
				position: absolute;
				top: 0;
				width: 0;
				height: 0;
			}

			&:before{
				left: $face__blush--position;
			}

			&:after{
				right: $face__blush--position;
			}
		}
	}

	.ears {
		@include face;

		&:before,
		&:after {
			content: "";
			position: absolute;
			top: 44%;
			background: $skin--color;
			height: 22px;
			width: $ears--width;
			z-index: $ears-index;
		}

		&:before {
			left: -$ears--width;
			border-radius: $ears--radius--outer $ears--radius--inner $ears--radius--inner $ears--radius--outer;
		}

		&:after {
			right: -$ears--width;
			border-radius: $ears--radius--inner $ears--radius--outer $ears--radius--outer $ears--radius--inner;
		}
	}

	.hair {
		position: absolute;
		background: $hair--color;
		top: 18%;
		left: $face__position;
	}
}

@mixin standard-girl($person-skin-color, $person-hair-color, $person-hair-length, $person-hair-extra-width, $person-hair-front-width, $person-ears-size) {

	/* -------------------------------------------

		Default CSS Variables (Girl) */

		$skin--color: $person-skin-color;
		$hair--color: $person-hair-color;

		$girl__face__border-radius--top: 50px;
		$girl__face__border-radius--bottom: 50px;
		$girl__hair__border-radius--top: 60px;
		$girl__hair__border-radius--bottom: 10px;

		$girl__hair--length: $person-hair-length;
		$girl__hair--width: $face--width + $person-hair-extra-width;
		$girl__hair__secondary--position: 8px;
		$girl__hair__secondary--color: darken($hair--color, 5%);
		$girl__hair__secondary--thickness: $person-hair-front-width;

	/* ------------------------------------------- */

	header {
		border-radius: $girl__face__border-radius--top $girl__face__border-radius--top $girl__face__border-radius--bottom $girl__face__border-radius--bottom;
	}

	.hair {
		height: $girl__hair--length;
		width: calc(#{$girl__hair--width});
		margin-left: calc((-#{$girl__hair--width}) / #{$face__spacing});
		border-radius: $girl__hair__border-radius--top $girl__hair__border-radius--top $girl__hair__border-radius--bottom $girl__hair__border-radius--bottom;

		&:before,
		&:after {
			content: "";
			position: absolute;
			top: $girl__hair__secondary--position;
			z-index: $secondary-hair-index;
			height: calc(#{$girl__hair--length} - #{$girl__hair__secondary--position});
			width: $person-hair-extra-width + $girl__hair__secondary--thickness;
		}

		$border-radius--top--outer: 96px;
		$border-radius--top--inner: 5px;
		$border-radius--bottom--outer: 50px;
		$border-radius--bottom--inner: 5px;

		&:before {
			border-left: $girl__hair__secondary--thickness solid $girl__hair__secondary--color;
			border-radius: $border-radius--top--outer $border-radius--top--inner $border-radius--bottom--inner $border-radius--bottom--outer;
			left: 0;
		}

		&:after {
			border-right: $girl__hair__secondary--thickness solid $girl__hair__secondary--color;
			border-radius: $border-radius--top--inner $border-radius--top--outer $border-radius--bottom--outer $border-radius--bottom--inner;
			right: 0;
		}

		.right-side-fringe {
			position: absolute;
			top: -1%;
			right: 10px;
			height: 94px;
			width: 40px;
			border-right: $girl__hair__secondary--color solid 30px;
			border-radius: 5px 100px 100px 50px;
			-webkit-transform: rotate(-45deg);
			-moz-transform: rotate(-45deg);
			-o-transform: rotate(-45deg);
			-ms-transform: rotate(-45deg);
			transform: rotate(-45deg);
			z-index: $fringe-index;
		}

		.full-fringe {
			position: absolute;
			top: 4%;
			left: $face__position;
			margin-left: calc(-#{$face--width} / #{$face__spacing});
			width: $face--width;
			height: 94px;
			border-top: $girl__hair__secondary--color solid 40px;
			border-radius: 90px 90px 5px 5px;
			z-index: $fringe-index;
		}

		.both-side-fringe {

			&:before,
			&:after {
				content: "";
				position: absolute;
				top: -5%;
				height: 59px;
				width: 22px;
				z-index: $fringe-index;
			}

			&:before {
				border-left: $girl__hair__secondary--color solid 16px;
				border-radius: 72px 5px 50px 52px;
				left: 9px;
				-webkit-transform: rotate(-128deg);
				-moz-transform: rotate(-128deg);
				-o-transform: rotate(-128deg);
				-ms-transform: rotate(-128deg);
				transform: rotate(-128deg);
			}

			&:after {
				border-right: $girl__hair__secondary--color solid 16px;
				border-radius: 5px 72px 52px 50px;
				right: 9px;
				-webkit-transform: rotate(128deg);
				-moz-transform: rotate(128deg);
				-o-transform: rotate(128deg);
				-ms-transform: rotate(128deg);
				transform: rotate(128deg);
			}
		}
	}

	.bow {
		@include face;

		&:before,
		&:after {
			content: "";
			position: absolute;
			top: -20px;
			left: 25%;
			border-left: 25px solid #f59f9f;
			border-top: 8px solid transparent;
			border-bottom: 8px solid transparent;
			height: 16px;
			width: 0;
			border-radius: 8px 0 0 8px;
			z-index: -1;
		}

		&:after {
			-webkit-transform: rotate(180deg);
			-moz-transform: rotate(180deg);
			-o-transform: rotate(180deg);
			-ms-transform: rotate(180deg);
			transform: rotate(180deg);
			margin-left: 25px;
		}
	}
}

@mixin standard-boy($person-skin-color, $person-hair-color, $person-hair-length, $person-hair-extra-width, $person-ears-size) {

	/* -------------------------------------------

		Default CSS Variables (Boy) */

		$skin--color: $person-skin-color;
		$hair--color: $person-hair-color;

		$hair--length: $person-hair-length;

		$boy__face__border-radius--top: 40px;
		$boy__face__border-radius--bottom: 50px;
		$boy__hair__border-radius--top: 48px;
		$boy__hair__border-radius--bottom: 40px;

	/* ------------------------------------------- */

	header {
		border-radius: $boy__face__border-radius--top $boy__face__border-radius--top $boy__face__border-radius--bottom $boy__face__border-radius--bottom;
	}

	.hair {
		top: $person-hair-length - 60;
		height: $person-hair-length;
		width: calc(#{$face--width} + #{$person-hair-extra-width});
		margin-left: calc((-#{$face--width} + -#{$person-hair-extra-width}) / #{$face__spacing});
		border-radius: $boy__hair__border-radius--top $boy__hair__border-radius--top $boy__hair__border-radius--bottom $boy__hair__border-radius--bottom;
	}

	.beard + .mouth {
		top: 45%;
	}

	.beard {
		position: absolute;
		top: -27%;
		left: $face__position;
		height: 115px;
		width: 94px;
		margin-left: calc(-94px / #{$face__spacing});
		-webkit-box-shadow: 0px 32px 0px 0 rgba(92, 37, 35, 0.2);
		-moz-box-shadow: 0px 32px 0px 0 rgba(92, 37, 35, 0.2);
		box-shadow: 0px 32px 0px 0 rgba(92, 37, 35, 0.2);
		border-radius: 40px;
	}

	/*	@mustacheSize: (@size*.13);
		&:before,
		&:after{
			content: '';
			position: absolute;
			left: $face__position;
			top: (@size*.16);
			width: @mustacheSize;
			height: @mustacheSize;
		}
		&:before{
			border-radius: (@mustacheSize*2) @mustacheSize;
			background: #ffcd94;
			box-shadow: 0 5px 0 0 black;
			.rotate(25deg);
		}
		&:after{
			margin-left: (-@mustacheSize - @size*.02);
			border-radius: @mustacheSize @mustacheSize*2;
			background: #ffcd94;
			box-shadow: 0 5px 0 0 black;
			.rotate(-25deg); 
		}*/
}



/* -------------------- Rachel Face ----------------- */

	.rachelface {

		$rachel__skin--color: #ffcd94;
		$rachel__ears--size: 8px;
		$rachel__hair--color: #5C2523;
		$rachel__hair--length: 180px;
		$rachel__hair--extra-width: 20px;
		$rachel__hair--front-width: 20px;
		$rachel__blush--color: #DE5D83;

		@include standard(
			$rachel__skin--color,
			$rachel__hair--color,
			$rachel__ears--size,
			$rachel__blush--color
		);

		@include standard-girl(
			$rachel__skin--color,
			$rachel__hair--color,
			$rachel__hair--length,
			$rachel__hair--extra-width,
			$rachel__hair--front-width,
			$rachel__ears--size
		);

		.hair {

			&:after {
				display: none;
			}
		}
	}



/* -------------------- Jon Face ----------------- */

	.jonface {

		$jon__skin--color: #ffcd94;
		$jon__ears--size: 11px;
		$jon__hair--color: #5C2523;
		$jon__hair--length: 93px;
		$jon__hair--extra-width: 10px;
		$jon__blush--color: #E69E84;

		@include standard(
			$jon__skin--color,
			$jon__hair--color,
			$jon__ears--size,
			$jon__blush--color
		);

		@include standard-boy(
			$jon__skin--color,
			$jon__hair--color,
			$jon__hair--length,
			$jon__hair--extra-width,
			$jon__ears--size
		);

	}



/* -------------------- Hayley Face ----------------- */

	.hayleyface {

		$hayley__skin--color: #ffcd94;
		$hayley__ears--size: 8px;
		$hayley__hair--color: #860600;
		$hayley__hair--length: 180px;
		$hayley__hair--extra-width: 20px;
		$hayley__hair--front-width: 22px;
		$hayley__blush--color: #DE5D83;

		@include standard(
			$hayley__skin--color,
			$hayley__hair--color,
			$hayley__ears--size,
			$hayley__blush--color
		);

		@include standard-girl(
			$hayley__skin--color,
			$hayley__hair--color,
			$hayley__hair--length,
			$hayley__hair--extra-width,
			$hayley__hair--front-width,
			$hayley__ears--size
		);
		
	}


/* -------------------- Enita Face ----------------- */

	.enitaface {

		$enita__skin--color: #E6A676;
		$enita__ears--size: 8px;
		$enita__hair--color: #331917;
		$enita__hair--length: 140px;
		$enita__hair--extra-width: 30px;
		$enita__hair--front-width: 22px;
		$enita__blush--color: #BD6982;

		@include standard(
			$enita__skin--color,
			$enita__hair--color,
			$enita__ears--size,
			$enita__blush--color
		);

		@include standard-girl(
			$enita__skin--color,
			$enita__hair--color,
			$enita__hair--length,
			$enita__hair--extra-width,
			$enita__hair--front-width,
			$enita__ears--size
		);
		
	}

body {
	width: 600px;
	margin: 30px auto;
	
	h1 {
		font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
		font-weight: 100;
		letter-spacing: 0.5px;
		font-size: 40px;
		margin: 0 auto;
		text-align: center;
		color: #666666;
	}
}
            
          
!
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.

Console