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.
<h1>CSS TEXT ANIMATIONS</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Acme&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Ranchers&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Merienda:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Russo+One&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Play&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Arvo&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Indie+Flower&display=swap');
</style>
<h2>1. Dropping Text</h2>
<div class="wrapper one">
<div class="drop-main">
<div class="d">D</div>
<div class="r">R</div>
<div class="o">O</div>
<div class="p">P</div>
<div class="s">!</div>
</div>
</div>
<h2>2. Neon Text</h2>
<div class="wrapper two">
<div class="neon">
<h3>NEON</h3>
</div>
</div>
<h2>3. A Moving Background Behind A Text</h2>
<div class="wrapper three">
<div>
<h3>BALLOONS</h3>
</div>
</div>
<h2>4. Typing Text</h2>
<div class="wrapper four">
<div class="type">
<h3 class="typing">TYPING EFFECT</h3>
</div>
</div>
<h2>5. Floating Text</h2>
<div class="wrapper five">
<span class="float-box">
<h3 class="float">FLOAT</h3>
</span>
</div>
<h2>6. Flicker Text</h2>
<div class="wrapper six">
<div>
<h3 class="flicker">FLICKER</h3>
</div>
</div>
<h2>7. Disappear Text</h2>
<div class="wrapper seven">
<div>
<h3 class="text">
<span>DISAPPEAR</span>
</h3>
</div>
</div>
<h2>8. Smoke Text</h2>
<div class="wrapper eight">
<h3 class="smoke">
<span>S</span>
<span>M</span>
<span>O</span>
<span>K</span>
<span>E</span>
</h3>
</div>
<h2>9. Rotate Text</h2>
<div class="wrapper nine">
<div>
<h3 class="rotate">
<span>R</span>
<span>0</span>
<span>T</span>
<span>A</span>
<span>T</span>
<span>E</span>
</h3>
</div>
</div>
<h2>10. Bounce Text</h2>
<div class="wrapper ten">
<div>
<h3 class="bounce">
<span>B</span>
<span>0</span>
<span>U</span>
<span>N</span>
<span>C</span>
<span>E</span>
</h3>
</div>
</div>
/* WRAPPER LAYOUT */
body{
font-family: system-ui;
background: whitesmoke;
}
h1{
font-family: 'Acme', sans-serif;
font-size: 52px;
color: #671c1c;
}
h2{
font-weight:normal;
}
h1, h3{
text-align:center;
}
.wrapper {
display: flex;
overflow: auto;
margin-bottom: 20px;
}
.wrapper > div{
width: 100%;
padding: 30px 0;
}
/* ONE */
.wrapper.one{
background-color: #1a1a1a;
}
.drop-main{
display: flex;
font-size: 7rem;
margin: 1.5rem;
justify-content: center;
font-family: 'Russo One', sans-serif;
}
.d {
opacity: 0;
animation: drop .4s linear forwards;
color: #00FFFF;
}
.r {
opacity: 0;
animation: drop .4s linear forwards .2s;
color: #99ffff;
}
.o {
opacity: 0;
animation: drop .4s linear forwards .4s;
color: #CCffff;
}
.p {
opacity: 0;
animation: drop .4s linear forwards .6s;
color: #ffffff;
}
.s {
opacity: 0;
animation: drop .4s linear forwards .8s;
color: #de4040;
}
@keyframes drop {
0% {transform: translateY(-200px); opacity: 0;}
50% {transform: translateY(0px); opacity: 1;}
65% {transform: translateY(-17px); opacity: 1;}
75% {transform: translateY(-22px); opacity: 1;}
100% {transform: translateY(0px); opacity: 1;}
}
/* TWO */
.wrapper.two{
background-color: #2c0101;
font-size: 6rem;
font-family: 'Play', sans-serif;
}
.neon h3{
margin: 1rem auto;
animation: neon 1s ease infinite;
}
@keyframes neon {
0%,
100% {
text-shadow: 0 0 10px #ef00e3a8, 0 0 20px #ef00e3a8, 0 0 20px #ef00e3a8, 0 0 20px #ef00e3a8, 0 0 2px #FED128, 2px 2px 2px #806914;
color: #f5efcb;
}
50% {
text-shadow: 0 0 2px #800E0B, 0 0 5px #800E0B, 0 0 5px #800E0B, 0 0 5px #800E0B, 0 0 2px #800E0B, 4px 4px 2px #40340A;
color: #eda0d3;
}
}
/* THREE */
.wrapper.three{
background-color: #010c3d;
}
.three > div{
text-align: center;
}
.three h3{
font-family: 'Ranchers', cursive;
background: url(https://drive.google.com/uc?export=view&id=1qvnbL55D_X7Bzo6fwwtXNyjhBhgi1iyX);
margin: 1.5rem;
display: inline-flex;
font-size: 10rem;
background-position: 0 0;
-webkit-background-clip: text;
-webkit-text-fill-color: #5b728a54;
animation: animatedOne 30s linear infinite;
}
@keyframes animatedOne {
from { background-position: 0 0; }
to { background-position: 100% 0; }
}
/* FOUR */
.wrapper.four{
background-color: #9ba5b4;
font-size: 3rem;
font-family: 'Play', sans-serif;
}
.four .type{
padding: 2rem 1rem;
width: auto;
margin: auto;
}
.four h3 {
width: 13ch;
border-right: 4px solid black;
margin: 2rem auto;
white-space: nowrap;
overflow: hidden;
animation: typing 2s steps(13, end),
blink-caret .5s step-end infinite alternate;
}
@-webkit-keyframes typing { from { width: 0; } }
@-webkit-keyframes blink-caret { 50% { border-color: transparent; } }
/* FIVE */
.wrapper.five{
background-color: #99bec8;
font-size: 3rem;
font-family: 'Play', sans-serif;
}
.float-box{
margin: auto;
transform-style: preserve-3d;
transform-origin: left;
transform: perspective(100px) rotateY(10deg) ;
}
.float{
animation: floating 2s linear infinite;
margin: 3.5rem auto;
padding: 1rem;
background: #5a9bad;
color: #ffffff;
box-shadow: -20px -17px 8px 0px #5a9bad63;
}
@keyframes floating{
0%{
transform: translate(0%, 30%);
}
50%{
transform: translate(0%, -30%);
}
100%{
transform: translate(0%, 30%);
}
}
/* SIX */
.wrapper.six{
background-color: #222222;
}
.flicker {
font-size: 6rem;
font-family: 'Merienda', sans-serif;
margin: 1rem auto;
color: #fffefe61;
background: -webkit-gradient(linear, left top, right top, from(#e6e6e6), to(#1d1c1c), color-stop(0.8, #ffffff)) no-repeat;
background: gradient(linear, left top, right top, from(#222), to(#222), color-stop(0.8, #fff)) no-repeat;
background-size: 110px 100%;
-webkit-background-clip: text;
background-clip: text;
animation: flick 1.5s infinite;
}
@keyframes flick {
0% {
background-position: top left;
}
100% {
background-position: top right;
}
}
/* SEVEN */
.wrapper.seven{
background-color: #e66f40;
}
.seven > div{
width: auto;
margin: auto;
padding: 1.5rem;
}
.seven .text{
font-size: 6rem;
margin: 1rem auto;
color: #e5e5e5;
}
.text span{
font-family: 'Indie Flower', cursive;
line-height: 0;
animation: disappear 4s 2s both infinite;
}
@keyframes disappear {
50% {
text-shadow: 0 0 40px #cbc7c7;
}
to {
text-shadow: 0 0 20px #cbc7c7;
opacity: 0;
}
}
/* EIGHT */
.wrapper.eight{
font-size: 6rem;
background-color: #000000;
overflow: hidden;
color: transparent;
}
.eight .smoke{
margin: 3rem auto;
display: inline-flex;
}
.eight span {
display: inline-flex;
text-shadow: 0 0 0 #f5f5f5;
font-family: 'Play', sans-serif;
animation: smoke 5s ease infinite;
}
@keyframes smoke {
60% {
text-shadow: 0 0 40px #f5f5f5;
}
to {
transform: translate3d(12rem, -10rem, 0) skewX(50deg);
text-shadow: 0 0 20px #f5f5f5;
opacity: 0;
}
}
.eight span:nth-of-type(1) {
animation-delay: 3.1s;
}
.eight span:nth-of-type(2) {
animation-delay: 3.2s;
}
.eight span:nth-of-type(3) {
animation-delay: 3.3s;
}
.eight span:nth-of-type(4) {
animation-delay: 3.4s;
}
.eight span:nth-of-type(5) {
animation-delay: 3.5s;
}
/* NINE */
.wrapper.nine {
background-color: #09715d;
font-family: 'Arvo', serif;
}
.rotate span {
font-size: 5rem;
color: #f8f8f8;
display: inline-flex;
animation: rotate 2s infinite;
}
@keyframes rotate {
0%,75% {
transform: rotateY(360deg)
}
}
.nine span:nth-of-type(1) {
animation-delay: .2s;
}
.nine span:nth-of-type(2) {
animation-delay: .4s;
}
.nine span:nth-of-type(3) {
animation-delay: .6s;
}
.nine span:nth-of-type(4) {
animation-delay: .8s;
}
.nine span:nth-of-type(5) {
animation-delay: 1s;
}
.nine span:nth-of-type(6) {
animation-delay: 1.2s;
}
/* TEN */
.wrapper.ten {
background-color: #0e2839;
}
.bounce {
font-size: 5rem;
width: 100%;
margin: 3rem auto;
display: inline-flex;
justify-content: center;
-webkit-box-reflect: below -20px linear-gradient(transparent, #211e1e2e);
}
.bounce span {
display: inline-flex;
color: #c7f4ff;
font-family: 'Play', sans-serif;
animation: bounce 1s infinite;
}
@keyframes bounce {
0%,
50%,
100% {
transform: translateY(0);
}
25% {
transform: translateY(-20px);
}
}
.ten span:nth-of-type(1) {
animation-delay: .1s;
}
.ten span:nth-of-type(2) {
animation-delay: .2s;
}
.ten span:nth-of-type(3) {
animation-delay: .3s;
}
.ten span:nth-of-type(4) {
animation-delay: .4s;
}
.ten span:nth-of-type(5) {
animation-delay: .5s;
}
.ten span:nth-of-type(6) {
animation-delay: .6s;
}
$(document).ready(function(){
$('.drop-main').mouseleave(function(){
$(this).removeClass('clicked');
}).mouseenter(function(){
$(this).addClass('clicked').html($(this).html());
});
});
$(document).ready(function(){
$('.type').mouseleave(function(){
$(this).removeClass('clicked');
}).mouseenter(function(){
$(this).addClass('clicked').html($(this).html());
});
});
Also see: Tab Triggers