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 esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM 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="duggee">
<div class="ear ear--left"></div>
<div class="ear ear--right"></div>
<div class="face">
<div class="eyes"></div>
<div class="nose"></div>
<div class="mouth"></div>
</div>
<div class="woggle"></div>
<div class="neckerchief"></div>
<div class="badge badge__1"></div>
<div class="badge badge__2"></div>
<div class="badge badge__3"></div>
<div class="badge badge__4"></div>
<div class="arm arm--left">
<div class="paw"></div>
</div>
<div class="arm arm--right">
<div class="paw"></div>
</div>
<div class="leg leg--left">
<div class="paw"></div>
</div>
<div class="leg leg--right">
<div class="paw"></div>
</div>
</div>
<div class="cloud cloud--left"><div></div></div>
<div class="cloud cloud--right"><div></div></div>
$sky: #B8EDFF;
$grass: #B9D368;
$black: #000000;
$white: #FFFFFF;
$fur--light: #934900;
$fur--med: #873b01;
$fur--dark: #783a07;
$neckerchief: #FFFF00;
$shirt: #D79F00;
$trousers: #A87001;
html {
background: linear-gradient( to bottom,
$sky 0%, $sky 47%,
$grass 47%, $grass 100%
) fixed;
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.duggee {
position: relative;
width: 300px;
height: 400px;
background: linear-gradient( to bottom,
$fur--light 0%, $fur--light 50%,
$neckerchief 50%, $neckerchief 56%,
$shirt 56%, $shirt 92%,
$trousers 92%, $trousers 100%
);
border-radius: 80% 80% 150% 150% / 280% 280% 100% 100%;
&:before {
content: " ";
width: 250px;
height: 125px;
border-radius: 125px 125px 0 0;
background-color: $fur--light;
position: absolute;
top: -45px;
left: 25px;
}
}
.ear {
position: absolute;
top: 15%;
width: 180px;
height: 110px;
z-index: -1;
&--left {
left: -70px;
border-radius: 40% 0 0 40% / 50% 0 0 50%;
transform: rotate( -35deg );
background: linear-gradient( 165deg,
$fur--light 0%,
$fur--light 35%,
$fur--med 50%,
$fur--med 100%
);
}
&--right {
right: -70px;
border-radius: 0 40% 40% 0 / 0 50% 50% 0;
transform: rotate( 35deg );
background: linear-gradient( -165deg,
$fur--light 0%,
$fur--light 35%,
$fur--med 50%,
$fur--med 100%
);
}
&:before, &:after {
content: " ";
position: absolute;
}
&:before {
background-color: $fur--light;
width: 105px;
height: 15px;
top: -14px;
right: 0;
}
&--right:before {
left: 0;
}
&:after {
background-color: $sky;
border-radius: 50%;
top: -85px;
right: -15px;
width: 220px;
height: 85px;
}
&--right:after {
left: -15px;
}
}
.face {
width: 120px;
height: 80px;
background-color: #CC6733;
position: absolute;
top: 20%;
left: calc( 50% - 60px );
border-radius: 100% 100% 140% 130% / 130% 130% 140% 130%;
}
.eyes {
&:before, &:after {
content: " ";
position: absolute;
top: -22px;
width: 10px;
height: 10px;
background-color: $black;
border-radius: 100%;
}
&:before {
left: calc( 50% - 13px );
}
&:after {
right: calc( 50% - 13px );
}
}
.nose {
background-color: $black;
width: 40px;
height: 32px;
border-radius: 45% / 50%;
position: absolute;
top: -10px;
left: calc( 50% - 20px );
}
.mouth {
position: absolute;
top: 30%;
left: 25%;
width: 18px;
height: 12px;
border-radius: 0 0 0 90% / 0 0 0 120%;
border-color: #910726;
border-style: solid;
border-width: 0 0 4px 4px;
}
.woggle {
width: 38px;
height: 30px;
background-color: #0265CB;
border-radius: 15%;
position: absolute;
top: calc( 50% - 2px );
left: calc( 50% - 19px );
}
.neckerchief {
width: 26px;
height: 85px;
background-color: $neckerchief;
position: absolute;
top: 57%;
left: calc( 50% - 13px );
&:after {
content: " ";
position: absolute;
top: 100%;
width: 0;
height: 0;
border: 13px solid transparent;
border-top-color: $neckerchief;
}
}
.badge {
position: absolute;
&__1 {
top: 60%;
left: 23%;
width: 0;
height: 0;
border: 20px solid transparent;
border-top-color: $neckerchief;
border-radius: 10% / 25%;
&:after {
content: " ";
position: absolute;
top: -16px;
left: -10px;
width: 0;
height: 0;
border: 10px solid transparent;
border-top-color: #723301;
}
}
&__2 {
top: 59%;
right: 24%;
background-color: #FDCE01;
width: 19px;
height: 19px;
border: 5px solid #EE6A00;
border-radius: 50%;
}
&__3 {
top: 68%;
left: 25%;
background-color: #A42C06;
border: 5px solid #B7CADC;
border-radius: 15%;
width: 15px;
height: 15px;
transform: rotate( 45deg );
}
&__4 {
top: 69%;
right: 24%;
background-color: #FB9893;
width: 12px;
height: 12px;
border: 7px solid #9A3157;
border-radius: 50%;
}
}
.arm {
position: absolute;
top: 82%;
color: $fur--med;
&--left {
left: 25px;
}
&--right {
right: calc( 25px + 3em );
}
}
.leg {
position: absolute;
top: 98%;
width: 30px;
height: 50px;
background-color: $trousers;
color: $fur--dark;
&--left {
left: calc( 50% - 60px );
// Shadow
&:after {
content: " ";
background-color: #3D0C16;
width: 300px;
height: 20px;
border-radius: 50%;
position: absolute;
top: 101%;
left: -130px;
z-index: -1;
}
}
&--right {
right: calc( 50% - 60px );
}
}
.paw {
&, &:before, &:after {
position: absolute;
width: 1em;
height: 1em;
background-color: currentColor;
border-radius: 0 0 0.4em 0.4em / 0 0 0.5em 0.5em;
}
&:before, &:after {
content: " ";
}
&:before {
left: 100%;
}
&:after {
left: 200%;
}
.leg & {
font-size: 10px;
top: 100%;
}
}
.cloud {
width: 115px;
height: 30px;
background: $white;
position: absolute;
&--left {
top: 25%;
left: calc( 50% - 375px )
}
&--right {
top: 23%;
right: calc( 50% - 400px );
}
&:before, &:after,
div:before, div:after {
content: " ";
position: absolute;
bottom: 0;
background-color: $white;
border-radius: 50%;
}
&:before, &:after {
width: 36px;
height: 36px;
}
&:before {
left: -18px;
}
&:after {
right: -18px;
}
div:before {
width: 70px;
height: 70px;
}
div:after {
width: 50px;
height: 50px;
bottom: 11px;
}
&--right div:before,
&--left div:after {
right: 8px;
}
&--left div:before,
&--right div:after {
left: 8px;
}
}
/*
Hey Duggee!
---
Image sources:
- https://ichef.bbci.co.uk/childrens-responsive-ichef-live/r/720/1x/cbeebies/hey-duggee-1024-576.jpg
- https://www.studioaka.co.uk/studioaka_files/image/2a8e5aa1b6c7a17638e29dbdaa228232.jpg
*/
Also see: Tab Triggers