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

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

              
                
<div class="scene">
	<aside class="scene-note">
		<h3 class="note-title">Did You Know</h3>
		<p>This llama is chewing it's <strong>cud</strong>. A "cud" is partialy digested food returned from an animal's first stomach* to its mouth for further chewing. Cows chew their cud, too, but llamas are cooler.</p>
		<p>How will your life be different with this game-changing information?</p>
		<p class="footnote">* Yes, llamas have more than one stomach! They have three, to be exact.</p>
	</aside>
	<div class="scene-contents">
	<svg id="llama" xmlns="http://www.w3.org/2000/svg" width="250px" height="399.9px">
	<defs>
		<linearGradient id="eye-close-gradient" x1="0" x2="0" y1="0" y2="1">
			<stop offset="0%" stop-color="cornsilk" />
			<stop offset="50%" stop-color="cornsilk" />
			<stop offset="80%" stop-color="black" />
		</linearGradient>
		<radialGradient id="eye-open-gradient">
			<stop offset="0%" stop-color="cornsilk" />
			<stop offset="20%" stop-color="black" />
		</radialGradient>
	</defs>
	<path class="leg back left" d="M116.3,288.9 106.3,392.5 82.7,392.2 74.6,288.9 "/>
	<path class="leg front left" d="M229.5,290.3 219.4,391.2 195.9,390.9 187.8,290.3 "/>
	<path class="tail" d="M46.4,222.1c0,0-12.8-9.1-19.4-15.8S1.6,195.7,1.6,195.7s8.1-13.4,23.3-13.4s31.4,18.9,31.4,18.9L46.4,222.1z"
		/>
	<g id="llama-head">
		<path class="neck" d="M190.2,201.9 226,98.1 260.2,109.8 237.3,218.1 	"/>
		<path class="jaw" d="M224.8,103.7l2.8-13l84.1,17.8c0,0-3.4,11-9,12.6c-3.9,1.1-35.2-6.5-56.9-12"/>
		<path class="head" d="M266,101.4l45.8,3.1c0,0,7.9-19.5-0.9-30.4c-5.7-7.1-37.3-16.9-59.3-18.4c0,0-2.5-36.1,4.6-41.8
			s11.8,5.4,16.2,1.8c4.5-3.6,4.7-5.3,1.1-9.8s-20.9-6.9-28-2.6C236,9.1,235.8,54,235.8,54c-2.8-0.1-6.3,6.2-8.1,14.3
			c-2.4,10.3-1.3,26.9-1.3,26.9"/>
		<path class="eye filled" d="M264.1,74.4c-0.4,4-3.3,0.3-7.3-0.1c-4-0.4-7.5,2.5-7.1-1.5s4-6.8,8-6.4C261.7,66.9,264.5,70.5,264.1,74.4z"/>
		
		<path class="nostril filled" d="M310.8,83.1c-0.8,1.2-2.6,0.4-4.6-0.9c-2-1.3-3.5-2.7-2.7-3.9c0.8-1.2,2.6-0.4,4.6,0.9C310.1,80.5,311.6,81.9,310.8,83.1z"
			/>
	</g>
	<path class="body" d="M233,201.1c16.1,16.1,13.8,84.4,0,98.2c-13.8,13.8-188.6,11.8-200.5,0c-11.8-11.8-14.7-83.5,0-98.2
		c13.6-13.6,132.2-20.8,167.9-8.5"/>
	<g id="llama-hair">	
		<path d="M91.1 242.4c0 6-4.9 10.9-10.9 10.9c-6 0-10.9-4.9-10.9-10.9"/>
		<path d="M115.7 215.6c0 6-4.9 10.9-10.9 10.9s-10.9-4.9-10.9-10.9"/>
		<path d="M117.3 268.3c0 6-4.9 10.9-10.9 10.9c-6 0-10.9-4.9-10.9-10.9"/>
		<path d="M187.8 246.8c0 6-4.9 10.9-10.9 10.9s-10.9-4.9-10.9-10.9"/>
		<path d="M204.9 272.4c0 6-4.9 10.9-10.9 10.9s-10.9-4.9-10.9-10.9"/>
		<path d="M67.1 272.4c0 6-4.9 10.9-10.9 10.9s-10.9-4.9-10.9-10.9"/>
		<path d="M66.2 215.6c0 6-4.9 10.9-10.9 10.9s-10.9-4.9-10.9-10.9"/>
		<path d="M165.2 210.2c0 6-4.9 10.9-10.9 10.9s-10.9-4.9-10.9-10.9"/>
		<path d="M143.4 246.8c0 6.1-4.9 11-10.9 11s-10.9-4.9-10.9-11"/>
		<path d="M211.2 215.6c0 6-4.9 10.9-10.9 10.9c-6 0-10.9-4.9-10.9-10.9"/>
		<path d="M232.2 247.8c0 6-4.9 10.9-10.9 10.9c-6 0-10.9-4.9-10.9-10.9"/>
		<path d="M154.3 283.4c0 6.1-4.9 11-10.9 11s-10.9-4.9-10.9-11"/>
	</g>
	<path class="leg right front" d="M207.6 298 196.6 399 171.1 398.7 162.3 298 "/>
	<path class="leg right back" d="M88.2 294.4 78.1 398 54.5 397.7 46.4 294.4 "/>
	</svg>
</div>
	<div class="scene-ground"></div>
</div>
              
            
!

CSS

              
                $llamaColor: cornsilk;
$strokeWidth: 1.75;
$strokeColor: slategray;
$groundColor: mediumseagreen;
$skyColor: skyblue;
$eyeFill: url(#eye-open-gradient);
$eyeCloseFill: url(#eye-close-gradient);
$breakpoint: 500px;

* {
	box-sizing: border-box;
}

@media screen and (min-width: $breakpoint) {		
	html, 
	body, 
	.scene {
		height: 100%;
	}
}


// ----
// Scene
// ----

.scene {
	background-color: $skyColor;
	display: grid;
	grid-auto-flow: column;
	grid-template-rows: 1fr 500px 1fr;
	grid-template-columns: minmax(40%, 400px) 1fr;
	
	@media screen and (min-width: $breakpoint) {	
		grid-template-rows: 1fr 2fr 1fr;
	}
}

.scene-note {
	grid-row: 1;
	grid-column: 1 / span 2;
	padding: 1rem;
	margin: 1rem;
	background-color: whitesmoke;
	border-radius: 5px;
	box-shadow: 0px 0px 2px $strokeColor;
	font-family: 'Comic Sans MS', Helvetica, sans-serif;
	line-height: 1.3;
	
	@media screen and (min-width: $breakpoint) {	
		grid-column: 1;
	}
}

.scene-contents {
	grid-row: 1 / span 2;
	grid-column: 1 / span 3;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	position: relative;
	z-index: 2;
} 

.scene-ground {
	grid-row: 3 / 3;
	grid-column: 1 / 3;
	background: $groundColor;
	width: 100%;
	margin-top: -30px;
}



// ----
// Note
// ----

.note-title {
	font-weight: 700;
}

.footnote {
	font-size: 0.8rem;
}



// ----
// Llama
// ----

#llama {
	overflow: visible;
	fill: $llamaColor;
	stroke-width: $strokeWidth;
	stroke: $strokeColor;
}

.nostril {
	fill: $strokeColor;
}

.eye {
	stroke-width: 0;
	fill: $eyeFill;
}



// ----
// Animations
// ----

.flicking,
.chewing {
	transform-box: fill-box; // For Firefox
}

.flicking {
	animation-name: flick;
	animation-duration: 5s;
	animation-iteration-count: infinite;
	animation-delay: 3s;
}

.chewing {
	animation-name: chew;
	animation-duration: 0.75s;
	animation-iteration-count: infinite;
}

.blinking {
	animation-name: blink;
	animation-duration: 5s;
	animation-iteration-count: infinite;
	animation-delay: 3s;
}


@keyframes blink {
	0% {
		fill: $eyeCloseFill;
		transform: translateY(-1px);
	}
	30% {
		fill: $eyeFill;
	}
	100% {
		fill: $eyeFill;
	}
}

@keyframes chew {
	0% {
		transform: rotate(10deg);
		transform-origin: 0 50%;
	}
	100% {
		transform: rotate(-1deg);
		transform-origin: 100% 100%;
	}
}

@keyframes flick {
	10%, 70% {
		transform: rotate(-20deg);
		transform-origin: 100% 100%;
	}
	
	20% {
		transform: rotate(50deg);
		transform-origin: 100% 100%;
	}
	
	100% {
		transform: rotate(0);
	}
}
              
            
!

JS

              
                
// Add animation classes with JS cause why not.

const EYE = document.querySelector('.eye'),
			JAW = document.querySelector('.jaw'),
			TAIL = document.querySelector('.tail');

EYE.classList.add("blinking");
JAW.classList.add("chewing");
TAIL.classList.add("flicking");
              
            
!
999px

Console