HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="vangel">
<div class="eye eye-left">
<div class="eye-front"></div>
</div>
<div class="eye eye-right">
<div class="eye-front"></div>
</div>
<div class="ear ear-left"></div>
<div class="ear ear-right"></div>
<div class="neck"></div>
<div class="beard"></div>
<div class="moustache moustache-left"></div>
<div class="moustache moustache-right"></div>
<div class="nose"></div>
<div class="mouth"></div>
<div class="hair hair-left"></div>
<div class="hair hair-right"></div>
<div class="hair-front"></div>
<div class="chin"></div>
<div class="forehead"></div>
</div>
// Basic variables & mixins
$white: #fff;
$somon: #F6C09D;
$light-somon: #EA696C;
$dark-somon: #F4AD93;
$blue: #69BCCF;
$dark-brown: #8B572A;
$light-brown: #B47137;
$brown: #A2652F;
$black: #00243A;
$pink: #EC2860;
// Shape mixin
@mixin shape($background, $width, $height, $radius: "") {
background: $background;
width: $width;
height: $height;
border-radius: #{$radius};
}
// Absolute positioning mixin
@mixin center($position) {
position: absolute;
@if $position == both {
top: 50%; left: 50%; transform: translate(-50%, -50%);
}
@else if $position == vertical {
top: 50%; transform: translatey(-50%);
}
@else if $position == horizontal {
left: 50%; transform: translatex(-50%);
}
}
// Base styles
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
display: flex;
height: 100vh;
justify-content: center;
align-items: center;
background: #240115;
}
// VangelTzo face Styles
.vangel {
position: relative;
@include shape($somon, 187px, 310px, "100px / 40%");
box-shadow: inset 20px 20px darken($somon, 5);
&:before { // Avatar back circle
content: "";
@include shape(darken(#240115, 5), 350px, 350px, 50%);
@include center(both);
z-index: -1;
}
}
.nose {
@include shape($dark-somon, 30px, 65px, 20px);
@include center(both);
top: 55%;
&:before { // nose circle
content: "";
@include shape($dark-somon, 40px, 40px, 50%);
@include center(horizontal);
bottom: 0;
box-shadow: inset 0 -10px darken($dark-somon, 5);
}
}
.eye {
@include shape($white, 40px, 40px, 50%);
position: absolute;
top: 45%;
left: 35px;
transform: translatey(-50%);
z-index: 1;
&:before { // eye pupil
content: "";
@include shape($blue, 15px, 15px, 50%);
@include center(both);
transition: transform .5s;
}
&:after { // eyebrow
content: "";
@include shape($dark-brown, 55px, 20px, 10px);
position: absolute;
top: -15px;
right: 0;
box-shadow: inset 5px -5px darken($light-brown, 5);
transform: rotate(-5deg);
transition: transform .5s;
}
&.eye-right {
left: auto;
right: 35px;
&:after { // eyebrow
right: auto;
left: 0;
box-shadow: inset -5px -5px darken($light-brown, 5);
transform: rotate(5deg);
}
}
}
.eye-front {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 0;
background: $dark-somon;
border-radius: 50% 50% 0 0;
transition: height .5s;
}
.hair {
@include shape($dark-brown, 80px, 145px, 40px);
z-index: -1;
position: absolute;
top: 30px;
left: -20px;
box-shadow: inset 10px -20px darken($light-brown, 5);
&.hair-right {
left: auto;
right: -20px;
box-shadow: inset -10px -20px darken($light-brown, 5);
}
}
.hair-front {
@include shape($light-brown, 180px, 70px, "30px 0 30px 30px");
@include center(horizontal);
top: -10px;
box-shadow: inset -25px -20px darken($light-brown, 5);
transition: transform .5s;
&:after {
content: "";
@include shape($brown, 45px, 15px, 20px);
position: absolute;
top: 10px;
left: 65%;
transform: translate(-50%);
box-shadow: -50px 20px 0 -3px $brown;
}
}
.ear {
@include shape($light-somon, 70px, 70px, 50%);
position: absolute;
border: 15px solid $dark-somon;
left: -30px;
top: 60%;
transform: translatey(-50%);
z-index: -1;
&.ear-right {
left: auto;
right: -30px;
}
}
.mouth {
@include shape($black, 70px, 50px, 35px);
position: absolute;
left: 50%;
top: 76%;
transform: translate(-50%, -50%);
overflow: hidden;
transition: width .5s, height .5s;
&:after { // teeth
content: "";
@include shape($white, 100px, 10px, 10px);
@include center(horizontal);
top: 0;
box-shadow: 0 45px $white;
}
&:before { // tongue
content: "";
@include shape($pink, 50px, 20px, 20px);
@include center(horizontal);
top: 35px;
}
}
.beard {
@include shape($dark-brown, 190px, 120px, "0 0 45px 45px");
@include center(horizontal);
bottom: 0;
box-shadow: inset 0 -25px darken($dark-brown, 5);
}
.moustache {
@include shape($light-brown, 70px, 25px, 15px);
position: absolute;
left: 50%;
top: 63%;
transform: translate(-90%, -50%) rotate(-30deg);
box-shadow: inset 5px -10px darken($light-brown, 5);
transition: transform .5s;
&.moustache-right {
transform: translate(-10%, -50%) rotate(30deg);
box-shadow: inset -10px -10px darken($light-brown, 5);
}
}
.chin {
@include shape($light-brown, 75px, 50px, 20px);
@include center(horizontal);
bottom: -15px;
box-shadow: inset 0 -20px darken($light-brown, 5);
transition: bottom .5s;
&:after {
content: "";
@include shape($dark-brown, 10px, 20px, 5px);
@include center(both);
}
}
.forehead {
@include shape($dark-somon, 80px, 5px, 5px);
@include center(horizontal);
top: 85px;
&:before {
content: "";
@include shape($dark-somon, 50px, 5px, 5px);
@include center(horizontal);
top: -10px;
}
}
.neck {
@include shape($somon, 100px, 50px, 20px 20px 50% 50%);
@include center(horizontal);
bottom: -35px;
}
// On hover Animations
.vangel:hover {
.eye-left:after { transform: translatey(-50%) rotate(-10deg); }
.eye-right:after { transform: translatey(-50%) rotate(10deg); }
.eye:before { transform: translate(-50%, -30%); }
.mouth { width: 80px; height: 40px; }
.chin { bottom: -10px; }
.hair-front { transform: translatex(-50%) rotate(-5deg); }
.moustache-left { transform: translate(-90%, -50%) rotate(-10deg); }
.moustache-right { transform: translate(-10%, -50%) rotate(10deg); }
.eye-front { height: 25%; }
}
// *,
// *:before,
// *:after {
// box-sizing: border-box;
// }
// body {
// display: flex;
// height: 100vh;
// justify-content: center;
// align-items: center;
// }
// @mixin shape($background, $width, $height, $radius: "") {
// background: $background;
// width: $width;
// height: $height;
// border-radius: #{$radius};
// }
// .vangel {
// position: relative;
// @include shape(#F6C09D, 187px, 310px, "100px / 40%");
// box-shadow: inset 20px 20px darken(#F6C09D, 5);
// }
// .nose {
// position: absolute;
// top: 55%;
// left: 50%;
// @include shape(#F4AD93, 187px, 310px, "100px / 40%");
// transform: translate(-50%, -50%);
// width: 30px;
// height: 65px;
// background: #F4AD93;
// border-radius: 20px;
// &:before { // nose circle
// content: "";
// width: 40px;
// height: 40px;
// background: #F4AD93;
// border-radius: 50%;
// position: absolute;
// bottom: 0;
// left: 50%;
// transform: translatex(-50%);
// box-shadow: inset 0 -10px darken(#F4AD93, 5);
// }
// }
// .eye {
// width: 40px;
// height: 40px;
// background: #fff;
// border-radius: 50%;
// position: absolute;
// top: 45%;
// transform: translatey(-50%);
// left: 35px;
// &:before { // eye center
// position: absolute;
// content: "";
// width: 15px;
// height: 15px;
// border-radius: 50%;
// background: #69BCCF;
// top: 50%;
// left: 50%;
// transform: translate(-50%, -50%);
// }
// &:after { // eyebrow
// position: absolute;
// content: "";
// width: 55px;
// height: 20px;
// border-radius: 10px;
// background: #8B572A;
// top: -15px;
// right: 0;
// box-shadow: inset 5px -5px darken(#B47137, 5);
// }
// &.eye-right {
// left: auto;
// right: 35px;
// &:after { // eyebrow
// right: auto;
// left: 0;
// box-shadow: inset -5px -5px darken(#B47137, 5);
// }
// }
// }
// .hair {
// width: 80px;
// height: 145px;
// border-radius: 40px;
// background: #8B572A;
// z-index: -1;
// position: absolute;
// top: 30px;
// left: -20px;
// box-shadow: inset 10px -20px darken(#B47137, 5);
// &.hair-right {
// left: auto;
// right: -20px;
// box-shadow: inset -10px -20px darken(#B47137, 5);
// }
// }
// .hair-front {
// width: 170px;
// height: 70px;
// border-radius: 30px 0 30px 30px;
// background: #B47137;
// position: absolute;
// top: -10px;
// left: 50%;
// transform: translate(-50%);
// box-shadow: inset -25px -20px darken(#B47137, 5);
// &:after {
// content: "";
// width: 45px;
// height: 15px;
// border-radius: 20px;
// background: #A2652F;
// position: absolute;
// top: 10px;
// left: 65%;
// transform: translate(-50%);
// box-shadow: -50px 20px 0 -3px #A2652F;
// }
// }
// .ear {
// width: 70px;
// height: 70px;
// border-radius: 50%;
// background: #EA696C;
// position: absolute;
// border: 15px solid #F4AD93;
// left: -30px;
// top: 60%;
// transform: translatey(-50%);
// z-index: -1;
// &.ear-right {
// left: auto;
// right: -30px;
// }
// }
// .mouth {
// width: 70px;
// height: 60px;
// border-radius: 35px;
// background: #00243A;
// position: absolute;
// left: 50%;
// top: 76%;
// transform: translate(-50%, -50%);
// overflow: hidden;
// &:after { // teeth
// content: "";
// width: 100px;
// height: 15px;
// border-radius: 10px;
// background: #fff;
// position: absolute;
// left: 50%;
// top: 0;
// transform: translatex(-50%);
// box-shadow: 0 45px #fff;
// }
// &:before { // tongue
// content: "";
// width: 50px;
// height: 20px;
// border-radius: 20px;
// background: #EC2860;
// position: absolute;
// left: 50%;
// top: 35px;
// transform: translatex(-50%);
// }
// }
// .beard {
// background: #8B572A;
// width: 190px;
// height: 120px;
// border-radius: 0 0 45px 45px;
// position: absolute;
// left: 50%;
// bottom: 0;
// transform: translatex(-50%);
// box-shadow: inset 0 -25px darken(#8B572A, 5);
// }
// .moustache {
// background: #B47137;
// width: 70px;
// height: 25px;
// border-radius: 15px;
// position: absolute;
// left: 50%;
// top: 63%;
// transform: translate(-90%, -50%) rotate(-30deg);
// box-shadow: inset 5px -10px darken(#B47137, 5);
// &.moustache-right {
// transform: translate(-10%, -50%) rotate(30deg);
// box-shadow: inset -10px -10px darken(#B47137, 5);
// }
// }
// .ching {
// background: #B47137;
// width: 75px;
// height: 50px;
// border-radius: 20px;
// position: absolute;
// left: 50%;
// bottom: -15px;
// transform: translatex(-50%);
// box-shadow: inset 0 -20px darken(#B47137, 5);
// &:after {
// content: "";
// background: #8B572A;
// width: 10px;
// height: 20px;
// border-radius: 5px;
// position: absolute;
// left: 50%;
// top: 50%;
// transform: translate(-50%, -50%);
// }
// }
// .forehead {
// background: #F4AD93;
// width: 80px;
// height: 5px;
// border-radius: 5px;
// position: absolute;
// left: 50%;
// top: 85px;
// transform: translatex(-50%);
// &:before {
// content: "";
// background: #F4AD93;
// width: 50px;
// height: 5px;
// border-radius: 5px;
// position: absolute;
// left: 50%;
// top: -10px;
// transform: translatex(-50%);
// }
// }
// .neck {
// background: #E5B291;
// width: 100px;
// height: 50px;
// border-radius: 20px;
// position: absolute;
// left: 50%;
// bottom: -35px;
// transform: translatex(-50%);
// }
Also see: Tab Triggers