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.
<h1>
<img src="https://upload.wikimedia.org/wikipedia/commons/0/05/Mario_Series_Logo.svg" alt="Super Mario Timeline" />
<p class="header">Timeline</p>
<p class="description">Initial launch dates of games in the Super Mario series. </p>
</h1>
<ul class="timeline">
<div class="cloud cloud1"></div>
<div class="cloud cloud2"></div>
<div class="cloud cloud3"></div>
<div class="cloud-s cloud-s1"></div>
<div class="cloud-s cloud-s2"></div>
<div class="cloud-s cloud-s3"></div>
<div class="cloud-s cloud-s4"></div>
<div class="cloud-s cloud-s5"></div>
<div class="cloud-s cloud-s6"></div>
<div class="hill hill1"></div>
<div class="hill hill2"></div>
<div class="hill hill3"></div>
<div class="hill hill4"></div>
<div class="bush bush1"></div>
<div class="bush bush2"></div>
<div class="bush bush3"></div>
<div class="bush bush4"></div>
<div class="pipe pipe1"></div>
<div class="pipe pipe2"></div>
<div class="pipe pipe3"></div>
<div class="goal"></div>
<div class="castle"></div>
<div class="mario"></div>
<li class="click"><a></a>
<div class="overlay"><time datetime="1985-09">September 1985</time>
<p>Super Mario Brothers</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1986-06">June 1986</time>
<p>Super Mario Bros: The Lost Levels</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1988-10">October 1988</time>
<p>Super Mario Bros. 2</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1988-10">October 1988</time>
<p>Super Mario Bros. 3</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1989-04">April 1989</time>
<p>Super Mario Land</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1990-11">November 1990</time>
<p>Super Mario World</p>
</div>
</li>
<li>
<div class="coin"></div>
<a></a>
<div class="overlay"><time datetime="1992-10">October 1992</time>
<p>Super Mario Land: 6 Golden Coins</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1995-08">August 1995</time>
<p>Super Mario World 2: Yoshi's Island</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="1996-06">June 1996</time>
<p>Super Mario 64</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2002-07">July 2002</time>
<p>Super Mario Sunshine</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2006-05">May 2006</time>
<p>New Super Mario Bros.</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2007-11">November 2007</time>
<p>Super Mario Galaxy</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2009-11">November 2009</time>
<p>New Super Mario Bros. Wii</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2010-05">May 2010</time>
<p>Super Mario Galaxy 2</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2011-11">November 2011</time>
<p>Super Mario 3D Land</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2012-07">July 2012</time>
<p>New Super Mario Bros 2</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2012-11">November 2012</time>
<p>New Super Mario Bros. U</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2013-11">November 2013</time>
<p>Super Mario 3D World</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2015-09">September 2015</time>
<p>Super Mario Maker</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2016-12">December 2016</time>
<p>Super Mario Run</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2017-10">October 2017</time>
<p>Super Mario Odyssey</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2019-06">June 2019</time>
<p>Super Mario Maker 2</p>
</div>
</li>
<li><a></a>
<div class="overlay"><time datetime="2021-02">February 2021</time>
<p>Super Mario 3D World + Bowser's Fury</p>
</div>
</li>
</ul>
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Montserrat&display=swap");
$onyx: rgba(57, 62, 65, 1);
$timberwolf: rgba(211, 208, 203, 1);
body,
html {
margin: 0;
padding: 0;
background: rgb(149, 237, 255);
background: linear-gradient(
0deg,
rgba(149, 237, 255, 1) 0%,
rgba(31, 151, 254, 1) 100%
);
color: $onyx;
width: calc(100% - 2em);
font-family: "Montserrat", sans-serif;
display: flex;
flex-flow: column;
min-height: 80vh;
transition: 1s;
}
h1 {
position: fixed;
text-align: center;
width: 100%;
img {
width: 50vh;
}
.header {
font-family: "Press Start 2P", cursive;
text-transform: uppercase;
font-size: 1.2em;
margin: 0;
padding: 0;
color: white;
text-shadow: 0.1em 0.1em red;
width: 100%;
}
.description {
font-family: "Press Start 2P", cursive;
font-size: 0.25em;
text-align: center;
width: 50%;
margin: 1em auto;
line-height: 1.5em;
}
}
ul {
width: auto;
white-space: nowrap;
margin: 0;
padding: 0;
list-style: none;
position: absolute;
bottom: 20vh;
margin-left: 80vw;
padding-right: 50vw;
}
ul:before {
content: "";
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 20vh;
background-image: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/a0d4f96a4aa2122.png);
background-size: 2em;
}
ul li.click:not(.active):not(.visited):before {
content: "click \A \25BC";
display: block;
position: absolute;
top: -3em;
white-space: pre-wrap;
text-align: center;
font-family: "Press Start 2P", cursive;
font-size: 0.7em;
font-weight: bold;
left: calc(0px - 1em);
width: 5em;
opacity: 0.5;
animation: click 1s ease-in-out 0s infinite normal forwards;
}
@keyframes click {
0%,
100% {
transform: translateY(-0.3em);
}
50% {
transform: translateY(0.3em);
}
}
ul li {
display: inline-block;
width: 25vw;
overflow: hidden;
margin: 0;
padding: 0;
white-space: normal;
}
ul li .overlay {
display: none;
padding-right: 1em;
padding-left: 1em;
}
ul li .overlay:before {
content: "..";
position: absolute;
font-family: "Press Start 2P", cursive;
text-shadow: 0.1em 0.1em black;
left: 0;
top: -0.3em;
letter-spacing: 10.2em;
}
ul li .overlay:after {
content: "..";
position: absolute;
font-family: "Press Start 2P", cursive;
text-shadow: 0.1em 0.1em black;
left: 0;
bottom: 0.1em;
letter-spacing: 10.2em;
}
ul li.active .overlay {
position: fixed;
display: block;
bottom: 42vh;
left: calc(50% - 6em);
min-width: 10em;
max-width: 10em;
text-align: center;
white-space: normal;
background: #de5918;
color: #f7d8c7;
box-shadow: -2px 0 #f7d8c7, 0 -2px #f7d8c7, 0 2px black, 2px 0 black;
animation: mystery-box 0.5s ease-out 0s 1 normal forwards;
animation-delay: 0.2s;
transform-origin: bottom center;
transform: translateY(4em) scale(0);
}
@keyframes mystery-box {
0% {
transform: translateY(3em) scale(0);
}
100% {
transform: translateY(0em) scale(1);
}
}
ul li.active a {
border: 2px solid white;
}
ul li a {
display: block;
width: 2em;
height: 2em;
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/1d3110dedd750a9.png)
no-repeat;
background-size: 2em;
cursor: pointer;
border: 2px solid transparent;
margin-bottom: 4em;
&:hover {
border: 2px solid white;
}
}
.mario {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/4717f552c59c347.png)
no-repeat;
background-size: 2.5em;
display: block;
width: 2.5em;
height: 2.3em;
position: fixed;
bottom: 20vh;
left: calc(50% - 1.25em);
&.jump {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/ee2ecc687ac3ded.png)
no-repeat;
background-size: 2.5em;
bottom: calc(20vh + 2em);
}
}
time {
display: block;
font-family: "Press Start 2P", cursive;
transform-origin: center;
transform: scaleX(70%);
margin-top: 1em;
text-shadow: 0.1em 0.1em black;
}
.bush {
position: absolute;
bottom: 0;
width: 9em;
height: 2em;
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/baa2bf3f33eab8f.png)
no-repeat;
background-size: 9em;
}
.bush1 {
left: -80vw;
}
.bush2 {
left: 50%;
}
.bush3 {
left: 27%;
}
.bush4 {
right: 70vw;
}
.hill {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/a3ce658940e9d15.png)
no-repeat;
background-size: 8em;
position: absolute;
bottom: 0;
width: 8em;
height: 3em;
}
.hill1 {
left: -70vw;
}
.hill2 {
left: 25%;
}
.hill3 {
right: 65%;
}
.hill4 {
right: 65vw;
}
.pipe {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/ab2b05219d2a12d.png)
no-repeat;
background-size: 4em;
position: absolute;
bottom: 0;
width: 10em;
height: 4em;
}
.pipe1 {
left: 10vw;
}
.pipe2 {
left: 45%;
}
.pipe3 {
right: 35%;
}
.goal {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/c4104bf2a2cdffc.png)
no-repeat;
background-size: 2.5em;
position: absolute;
bottom: 0;
right: 40vw;
width: 2.5em;
height: 17.5em;
}
.castle {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/d73d6701fb6c0c1.png)
no-repeat;
background-size: 10em;
position: absolute;
bottom: 0;
right: 0;
width: 10em;
height: 9em;
}
.cloud {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/de22c357bcdfd0e.png)
no-repeat;
background-size: 6em;
position: absolute;
width: 6em;
height: 3em;
}
.cloud1 {
top: -100%;
left: -10vw;
}
.cloud2 {
top: -80%;
left: 35%;
}
.cloud3 {
top: -90%;
right: 20%;
}
.cloud-s {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/53736165bcbfe7e.png)
no-repeat;
background-size: 4em;
position: absolute;
width: 4em;
height: 3em;
}
.cloud-s1 {
top: -50%;
left: -40vw;
}
.cloud-s2 {
top: -40%;
left: 10%;
}
.cloud-s3 {
top: -55%;
left: 14%;
}
.cloud-s4 {
top: -95%;
left: 40%;
}
.cloud-s5 {
top: -85%;
left: 66%;
}
.cloud-s6 {
top: -55%;
right: 14%;
}
.coin {
background: url(https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/ffe952392545e39.png)
no-repeat;
background-size: 1.5em;
position: absolute;
width: 2.1em;
height: 2.1em;
animation: coin 1.5s ease-in-out 0s infinite normal forwards;
top: -2.5em;
background-position: center;
}
@keyframes coin {
0%,
100% {
transform: rotateY(0) translateY(-0.3em);
}
50% {
transform: rotateY(90deg) translateY(0.3em);
}
}
$(document).ready(() => {
$(window).click(function () {
$("li").removeClass("active");
});
$("li a").on("click", (e) => {
e.stopPropagation();
e.target.scrollIntoView({
behavior: "smooth",
block: "start",
inline: "center"
});
setTimeout(() => {
$(".mario").addClass("jump");
}, 200);
setTimeout(() => {
$(".mario").removeClass("jump");
}, 500);
$("li").removeClass("active");
$(e.target.parentElement).addClass("active");
if (!$(e.target.parentElement).hasClass("visited")) {
$(e.target.parentElement).addClass("visited");
}
});
});
Also see: Tab Triggers