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.
<!doctype html>
<!-- credit https://codepen.io/pbutcher/pen/wMxwbr
for the emojis
-->
<meta charset=utf-8>
<HTML>
<HEAD>
<link rel="stylesheet" href="style.css">
</HEAD>
<BODY>
<div class="glow"><marquee behavior="scroll" direction="left" scrollamount="15">CREATING ANIMATIONS WITH CSS </marquee></div>
<div class="head pink">
<div class="face happy">
<div class="eye left"></div>
<div class="eye right"></div>
<div class="mouth"></div>
</div>
</div>
<div class="head yellow">
<div class="face standard">
<div class="eye left"></div>
<div class="eye right"></div>
<div class="mouth"></div>
</div>
</div>
<div class="head blue">
<div class="face sad">
<div class="eye left"></div>
<div class="eye right"></div>
<div class="mouth"></div>
</div>
</div>
</BODY>
</HTML>
body {
width: 100wh;
height: 90vh;
color: #fff;
background: linear-gradient(-45deg, #ffd1f7, #fffbc6, #b4fcff, #ffd1f7,#b4fcff,#fffbc6);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
max-width:100%;
}
.glow {
position:absolute;
width: 80%;
left:10%;
top: 10%;
height: 80px;
margin: 0 auto;
text-align: center;
padding: 10px;
color: pink;
font: 60px 'Poiret One', cursive;
box-shadow: inset 0px 0px 14px #ff96ed, 0px 0px 14px #ffd1f7;
text-shadow: 0px 0px 14px #ffd1f7, 2px 2px 4px #000;
border: 2px solid pink;
border-radius: 15px;
animation: neon 12s ease infinite;
}
@keyframes neon {
0% {
color: #b4fcff;
border: 2px solid #b4fcff;
text-shadow: 0px 0px 10px #b4fcff, 2px 2px 4px #000;
box-shadow: inset 0px 0px 10px #8cfbff, 0px 0px 10px #b4fcff;
}
50% {
color: #ffd1f7;
border: 2px solid #ffd1f7;
text-shadow: 0px 0px 14px #ffd1f7, 2px 2px 4px #000;
box-shadow: inset 0px 0px 14px #ffbbbb, 0px 0px 14px #ffd1f7;
}
75% {
color: #fffbc6;
border: 2px solid #fffbc6;
text-shadow: 0px 0px 10px #fffbc6, 2px 2px 4px #000;
box-shadow: inset 0px 0px 10px #fff77a, 0px 0px 10px #fffbc6;
}
100% {
color: #b4fcff;
border: 2px solid #b4fcff;
text-shadow: 0px 0px 10px #b4fcff, 2px 2px 4px #000;
box-shadow: inset 0px 0px 10px #97fbff, 0px 0px 10px #b4fcff;
}
}
@-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-moz-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
html, body {
margin: 0;
display: flex;
width: 100%;
height: 100%;
background-color: #FFFCEF;
}
.head {
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: auto;
width: 250px;
height: 250px;
background-color: #FFEB97;
border-radius: 50%;
position: relative;
}
.face {
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: auto;
width: 250px;
height: 250px;
position: relative;
}
.pink{
background-color: #ffd1f7;
}
.yellow{
background-color: #fffbc6;
}
.blue{
background-color: #b4fcff;
}
.happy {
animation: happy-look 5s infinite;
}
.standard {
animation: standard-look 5s infinite;
}
.sad {
animation: sad-look 5s infinite;
}
.eye
{
width: 25px;
height: 25px;
position: absolute;
background-color: #000;
border-radius: 50%;
}
.mouth
{
width: 100px;
height: 50px;
border-style: solid;
border-radius: 50%;
border-width: 8px;
border-color: transparent transparent #000 transparent;
position: absolute;
}
.happy .eye {
top: 75px;
animation: blink 12s infinite;
}
.happy .mouth {
left: 68px;
top: 80px;
animation: happy-mouth 10s infinite;
}
.left{
left:45px;
}
.right{
left:165px;
}
.standard .eye {
top: 125px;
animation: blink 6s infinite;
animation-delay: 1.3s;
}
.standard .mouth {
width: 75px;
height: 8px;
border-radius: 8px;
left: 75px;
top: 175px;
}
.sad .eye {
top: 130px;
position: absolute;
animation: blink 20s infinite;
animation-delay: 3.7s;
}
.sad .mouth {
border-color: #000 transparent transparent transparent;
left: 68px;
top: 186px;
animation: sad-mouth 10s infinite;
}
@keyframes blink {
0% {
transform: scale(1, 1);
}
10% {
transform: scale(1, 1);
}
12% {
transform: scale(1, .1);
}
14% {
transform: scale(1, 1);
}
30% {
transform: scale(1, 1);
}
32% {
transform: scale(1, .1);
}
34% {
transform: scale(1, 1);
}
60% {
transform: scale(1, 1);
}
62% {
transform: scale(1, .1);
}
64% {
transform: scale(1, 1);
}
}
@keyframes happy-look {
0% {
transform: translate(0px, 0px);
}
10% {
transform: translate(10px, 0px);
}
20% {
transform: translate(10px, 0px);
}
30% {
transform: translate(0px, 0px);
}
60% {
transform: translate(0px, 0px);
}
70% {
transform: translate(-10px, -15px);
}
80% {
transform: translate(-10px, -15px);
}
90% {
transform: translate(0px, 0px);
}
}
@keyframes happy-mouth {
0% {
height: 50px;
}
10% {
height: 50px;
}
20% {
height: 50px;
}
30% {
height: 50px;
}
60% {
height: 50px;
}
70% {
height: 40px;
}
80% {
height: 40px;
}
90% {
height: 50px;
}
}
@keyframes standard-look {
0% {
transform: translate(0px, 0px);
}
10% {
transform: translate(-25px, 0px);
}
20% {
transform: translate(-25px, 0px);
}
30% {
transform: translate(0px, 0px);
}
60% {
transform: translate(0px, 0px);
}
70% {
transform: translate(15px, -15px);
}
80% {
transform: translate(15px, -15px);
}
90% {
transform: translate(0px, 0px);
}
}
@keyframes sad-look {
0% {
transform: translate(0px, 0px);
}
15% {
transform: translate(0px, 0px);
}
25% {
transform: translate(0px, -25px);
}
35% {
transform: translate(0px, -25px);
}
45% {
transform: translate(0px, 0px);
}
70% {
transform: translate(0px, 0px);
}
80% {
transform: translate(-15px, -25px);
}
90% {
transform: translate(-15px, -25px);
}
100% {
transform: translate(0px, 0px);
}
}
@keyframes sad-mouth {
0% {
height: 25px;
}
15% {
height: 25px;
}
25% {
height: 50px;
}
35% {
height: 50px;
}
45% {
height: 25px;
}
70% {
height: 25px;
}
80% {
height: 50px;
}
90% {
height: 50px;
}
100% {
height: 25px;
}
}
Also see: Tab Triggers