cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="signage">
		<p>Emberly Autos</p>
	</div>
  	<div class="road"></div>

    <div class="car sedan">
		<div class="windows">
			<div class="sidewindowbar"></div>
		</div>
		<div class="body"></div>
		<div class="lights"></div>
		<div class="bumpers"></div>
		<div class="tires"></div>
	</div>

	<div class="car station-wagon">
		<div class="windows">
			<div class="sidewindowbar"></div>
		</div>
		<div class="body"></div>
		<div class="lights"></div>
		<div class="bumpers"></div>
		<div class="tires"></div>
	</div>
	<div class="car coupe">
		<div class="windows">
			<div class="sidewindowbar"></div>
		</div>
		<div class="body"></div>
		<div class="lights"></div>
		<div class="bumpers"></div>
		<div class="tires"></div>
	</div>
	<div class="car convertible">
		<div class="windows"></div>
		<div class="body">
			<div class="door"></div>
		</div>
		<div class="lights"></div>
		<div class="bumpers"></div>
		<div class="tires"></div>
	</div>
            
          
!
            
              $size: 5em;
$default-size: 10em;
$default-color: hsl(225, 43%, 48%);
$sedan-color: hsl(209, 100%, 50%);
$station-wagon-color: hsl(98, 39%, 45%);
$coupe-color: hsl(7, 93%, 39%);
$convertible-color: hsl(187, 100%, 29%);
$convertible-canopy-color: hsl(38, 37%, 48%);
$window-color: hsla(202, 80%, 89%, 0.62);
$transparent: hsla(0, 0%, 0%, 0);

@import url(https://fonts.googleapis.com/css?family=Amatic+SC:400,700);

@mixin anim-chassis-bounce($duration: 2s) {
	animation-duration: $duration;
	animation-iteration-count: infinite;
	animation-name: chassis-bounce;
}

@mixin anim-drive($duration, $delay) {
	animation-duration: $duration;
	animation-timing-function: linear;
	animation-iteration-count: infinite;
	animation-delay: $delay;
	animation-name: drive;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	
	&:before, &:after {
		box-sizing: border-box;
	}
}

body, html {
	min-height: 100%;
	font-size: 16px;
	width: 100%;
}

body {
	background-color: hsl(110, 43%, 74%);
}

%car {
	width: $size * 4;
	height: $size * 1.875;
	
	.windows {
		position: relative;
		width: $size * 2;
		height: $size * .75;
		left: -$size * .12;
		background-color: $window-color;
		border-top: $default-color solid $size * .125;
		border-right: $default-color solid $size * .125;
		border-left: $default-color solid $size * .125;
		border-bottom: $default-color solid 0;
		border-radius: $size * .125 $size * .125 0 0;
		margin: 0 auto;
		clear: both;
		
		@include anim-chassis-bounce();
		
		&:before {
			position: relative;
			float: left;
			width: $size * .13;
			height: $size * .75;
			left: -$size * .25;
			top: -$size * .12;
			content: "";
			background-color: $default-color;
			border-radius: $size * .0625 $size * .0625 0 0;
			transform: skewX(-25deg);
		}
		&:after {
			position: relative;
			float: right;
			width: $size * .13;
			height: $size * .75;
			right: -$size * .32;
			top: -$size * .12;
			content: "";
			background-color: $default-color;
			border-radius: $size * .0625 $size * .0625 0 0;
			transform: skewX(30deg);
		}
		
		.sidewindowbar {
			position: relative;
			float: left;
			width: $size * .12;
			height: $size * .63;
			left: $size * .63;
			background-color: $window-color;
			border-top: $default-color solid 0;
			border-right: $default-color solid $size * .0625;
			border-left: $default-color solid $size * .0625;
			border-bottom: $default-color solid 0;
		}
	}

	.body {
		position: relative;
		width: $size * 3.75;
		height: $size * .75;
		background-color: $default-color;
		border-radius: $size * .25 $size * .5 $size * .125 $size * .125;
		margin: 0 auto;
		margin-bottom: -$size * .625;
		
		@include anim-chassis-bounce();
	}

	.lights {
		position: relative;
		width: $size * 3.75;
		clear: both;
		
		@include anim-chassis-bounce();
		
		&:before {
			position: relative;
			float: left;
			width: $size * .125;
			height: $size * .25;
			left: $size * .125;
			content: "";
			background-color: hsl(0, 88%, 42%);
			border: hsl(225, 30%, 80%) $size * .0125 solid;
			border-radius: $size * .125 $size * .0625 $size * .0625 0
		}
		&:after {
			position: relative;
			float: right;
			width: $size * .25;
			height: $size * .25;
			//right: 0;
			content: "";
			background-color: hsl(0, 88%, 100%);
			border: hsl(225, 30%, 80%) $size * .0125 solid;
			border-radius: ($size * .25) ($size * .5) ($size * .25) ($size * .5);
		}
	
	}

	.bumpers {
		position: relative;
		width: $size * 4;
		height: $size * .125;
		top: $size * .125;
		background-color: $default-color;
		clear: both;
		
		@include anim-chassis-bounce();
		
		&:before {
			position: relative;
			float: left;
			width: $size * .0625;
			height: $size * .325;
			top: -$size * .1325;
			content: "";
			background-color: inherit;
			border-radius: $size * .0625;
		}
		&:after {
			position: relative;
			float: right;
			width: $size * .0625;
			height: $size * .325;
			top: -$size * .1325;
			content: "";
			background-color: inherit;
			border-radius: $size * .0625;
		}
	}

	.tires {
		position: relative;
		top: -$size * .125;
		width: $size * 3;
		height: $size;
		overflow: auto;
		margin: 0 auto;
		
		&:before {
			position: relative;
			float: left;
			bottom: 0;
			left: 0;
			width: $size * .75;
			height: $size * .75;
			content: "";
			background-color: hsl(225, 30%, 70%);
			border: ($size * .125) solid hsl(0, 0%, 0%);
			border-radius: 50%;
		}
		&:after {
			position: relative;
			float: right;
			bottom: 0;
			right: 0;
			width: $size * .75;
			height: $size * .75;
			content: "";
			background-color: hsl(225, 30%, 70%);
			border: ($size * .125) solid hsl(0, 0%, 0%);
			border-radius: 50%;
		}
	}
}



.sedan {
	@extend %car;
	position: absolute;
	transform: translate(-$size * 7, $size * 2);
	//transform: scaleX(1);
	
	@include anim-drive(17s, 3.81s);
	
	.windows {
		border-color: $sedan-color;
		&:before {
			background-color: $sedan-color;
		}
		&:after {
			background-color: $sedan-color;
		}
		.sidewindowbar {
			border-color: $sedan-color;
		}
	}
	.body {
		background-color: $sedan-color;
	}
	.bumpers {
		background-color: $sedan-color;
	}
}

.station-wagon {
	@extend %car;
	position: absolute;
	width: $size * 5;
	
	transform: translate(-$size * 7, $size * 2);
	
	@include anim-drive(15s, -1.1s);
	
	.windows {
		width: $size * 3.25;
		left: -$size * .5;
		border-color: $station-wagon-color;
		&:before {
			background-color: $station-wagon-color;
			transform: skewX(-15deg);
		}
		&:after {
			background-color: $station-wagon-color;
		}
		.sidewindowbar {
			width: $size * 1.25;
			left: $size * .75;
			border-color: $station-wagon-color;
			border-width: 0 ($size * .13) 0 ($size * .13);
		}
	}
	.body {
		width: $size * 4.75;
		background-color: $station-wagon-color;
		border-radius: 0 $size * .5 $size * .125 $size * .125;
	}
	.lights {
		width: $size * 4.75;
	}
	.bumpers {
		width: $size * 5;
		background-color: $station-wagon-color;
	}
	.tires {
		width: $size * 4.5;
	}
}

.coupe {
	@extend %car;
	position: absolute;
	width: $size * 5;
	
	transform: translate(-$size * 7, $size * 2);
	
	@include anim-drive(21s, 5s);
	
	.windows {
		width: $size * 2.25;
		border-color: $coupe-color;
		&:before {
			width: $size * .25;
			left: -$size * .5;
			background-color: $coupe-color;
			border-radius: $size * .063 $size * .063 0 0;
			transform: skewX(-45deg);
		}
		&:after {
			background-color: $coupe-color;
		}
		.sidewindowbar {
			width: $size * .1;
			left: $size;
			border-color: $coupe-color;
		}
	}
	.body {
		width: $size * 4;
		background-color: $coupe-color;
		border-radius: 0 ($size * .5) ($size * .12) 0;
		margin-bottom: -$size * .87;
		&:before {
			display: block;
			position: relative;
			width: $size * .75;
			height: $size * .75;
			left: -$size * .75;
			content: "";
			border-top: $transparent solid ($size * .37);
			border-right: $coupe-color solid ($size * .37);
			border-bottom: $coupe-color solid ($size * .37);
			border-left: $transparent solid ($size * .37);
			border-radius: 0 0 0 $size * .125;
		}
	}
	.lights {
		width: $size * 4.25;
		left: $size * .12;
		&:before {
			width: $size * .25;
			left: $size * .25;
			border-radius: $size * .5 $size * .25 $size * .5 $size * .25;
		}
	}
	.bumpers {
		width: $size * 4.87;
		left: -$size * .25;
		border-radius: $size * .5 0 0 0;
		background-color: $coupe-color;
		&:before {
			left: $size * .0625;
			transform: rotate(45deg);
		}
		&:after {
		}
	}
	.tires {
		width: $size * 3.75;
	}
}

.convertible {
	//@extend %car;
	@extend .coupe;
	
	@include anim-drive(16s, -4s);
	
	.windows {
		width: $size * 2;
		background-color: $transparent;
		border-color: $convertible-color;
		border-width: 0 $size * .12 0 0;
		border-left-color: $transparent;
		&:before {
			width: $size * 1.25;
			top: 0;
			background-color: $transparent;
			border-color: $transparent;
			border-top: $transparent solid ($size * .37);
			border-right: $transparent solid ($size);
			border-bottom: $convertible-canopy-color solid ($size * .37);
			border-left: $transparent solid ($size * .12);
			border-radius: 0 0 0 $size * .12;
			transform: none;
		}
		&:after {
			top: 0;
			background-color: $convertible-color;
		}
		.sidewindowbar {
			display: none;
		}
	}
	.body {
		width: $size * 3.75;
		background-color: $convertible-color;
		margin-bottom: -$size * .67;
		&:before {
			border-right-color: $convertible-color;
			border-bottom-color: $convertible-color;
		}
		.door {
			position: relative;
			width: $size;
			height: $size * .5;
			top: -$size * .75;
			left: $size * 1.5;
			border-top: 0;
			border-right: hsl(0, 0%, 0%) solid $size * .062;
			border-bottom: hsl(0, 0%, 0%) solid $size * .062;
			border-left: hsl(0, 0%, 0%) solid $size * .062;
			border-radius: 0 0 $size * .5 $size * .5;
		}
	}
	.lights {
		width: $size * 4;
		left: $size * .25;
		top: $size * .0625;
	}
	.bumpers {
		width: $size * 4.75;
		right: $size * .75;
		top: $size * .25;
		background-color: $convertible-color;
	}
	.tires {
		width: $size * 3;
	}
}

.signage {
	position: relative;
	width: 4.5em;
	margin: .25em auto -.5em auto;
	//transform: translate(30vw, .5em);
	font-family: 'Amatic SC';
	font-weight: 700;
	font-size: $size;
	text-align: center;

	& p {
		background-color: hsl(45, 100%, 96%);
		padding: .125em .25em .25em .25em;
		border-color: hsl(22, 86%, 18%);
		border-style: ridge;
		border-width: 0 0 .125em 0;
		clear: both;
		
		&:before {
			position: relative;
			display: block;
			float: left;
			top: -.25em;
			content: "";
			width: .25em;
			height: $size * .5;
			background-color: hsl(22, 86%, 18%);
			border-color: hsl(22, 86%, 18%);
			border-style: ridge;
			border-width: 0 .125em 0 0;
			border-radius: .25em .25em 0 0;
			margin-left: -.5em;
		}
		&:after {
			position: relative;
			display: block;
			float: right;
			top: -.25em;
			content: "";
			width: .25em;
			height: $size * .5;
			background-color: hsl(22, 86%, 18%);
			border-color: hsl(22, 86%, 18%);
			border-style: groove;
			border-width: 0 0 0 .125em;
			border-radius: .25em .25em 0 0;
			margin-right: -.5em;
		}
	}
}

.road {
	position: absolute;
	width: 100%;
	height: $size * 4; /* 2 times the hight of a car */
	top: $size * 3;
	background-color: hsl(261, 10%, 16%);
	border-color: hsl(43, 34%, 84%);
	border-style: ridge none;
	border-width: $size * .25;
	
	&:after {
		position: absolute;
		display: block;
		top: $size * 1.5;
		content: "";
		width: 100%;
		height: $size * .4;
		border-color: hsl(43, 80%, 55%);
		border-style: solid none;
		border-width: $size * .125;
	}
}

@keyframes chassis-bounce {
	0% {
		transform: translate(0, 0);
	}
	25% {
		transform: translate(-$size * .01, -$size * .052);
	}
	50% {
		transform: translate(0, 0);
	}
	75% {
		transform: translate($size * .01, -$size * .025);
	}
	100% {
		transform: translate(0, 0);
	}
}

@keyframes drive {
	0% {
		transform: translate(-$size * 7, $size * 1.1) scaleX(1);
	}
	20% {
		transform: translate(100vw, $size * .9);
	}
	30% {
		transform: translate(100vw, $size * .9) scaleX(-1);
		//transform:;
	}
	80% {
		transform: translate(100vw, $size * 3.1) scaleX(-1);
		//transform: ;
	}
	90% {
		transform: translate(-$size * 7, $size * 2.9) scaleX(-1);
		//transform: 
	}
	100% {
		transform: translate(-$size * 7, $size * .2) scaleX(1);
	}
	
}

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console