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.
section#solar-system
#sun
article#mercury-trajectory
#mercury
article#venus-trajectory
#venus
article#earth-trajectory
#earth
article#mars-trajectory
#mars
//
too far for my starship πͺπ
<article id="main-asteroid-belt-trajectory"></article>
<article id="jupiter-trajectory"></article>
<article id="saturn-trajectory"></article>
<article id="uranus-trajectory"></article>
<article id="neptune-trajectory"></article>
:root
{
--dark-color: rgb(0,0,0);
--glossy-red: rgba(238, 17, 17, 1);
--hidden-red: rgba(238, 17, 17, 0);
--light-red: rgba(238, 17, 17, .5);
--paths-theme: var(--very-light-red) var(--glossy-red);
--planets-theme: var(--light-red) var(--light-red) var(--light-red) var(--glossy-red);
--very-light-red: rgba(238, 17, 17, .25);
}
*, *::after, *::before
{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
margin: 0;
}
body
{
overflow: hidden;
background-color: var(--dark-color);
}
body #solar-system
{
display: flex;
width: 100vw;
height: 100vh;
-webkit-transform: skewX(-45deg);
-moz-transform: skewX(-45deg);
-ms-transform: skewX(-45deg);
-o-transform: skewX(-45deg);
transform: skewX(-45deg);
-webkit-transform-origin: center;
-moz-transform-origin: center;
-ms-transform-origin: center;
-o-transform-origin: center;
transform-origin: center;
justify-content: center;
align-items: center;
}
/* β size of the sun is not respected here */
section #sun
{
position: fixed;
z-index: 100;
/* β real radius of the sun: 696340km */
width: 174.085px; /* β 40* too small compared to the real planets dimensions values */
height: 174.085px;
-webkit-transform: skewX(45deg);
-moz-transform: skewX(45deg);
-ms-transform: skewX(45deg);
-o-transform: skewX(45deg);
transform: skewX(45deg);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: var(--glossy-red);
background: linear-gradient(135deg, var(--glossy-red) 20%, var(--hidden-red) 100%);
-webkit-background: linear-gradient(135deg, var(--glossy-red) 20%, var(--hidden-red) 100%);
-moz-background: linear-gradient(135deg, var(--glossy-red) 20%, var(--hidden-red) 100%);
-o-background: linear-gradient(135deg, var(--glossy-red) 20%, var(--hidden-red) 100%);
-ms-background: linear-gradient(135deg, var(--glossy-red) 20%, var(--hidden-red) 100%);
filter: drop-shadow(0 0 2rem var(--glossy-red)) blur(1px);
-webkit-filter: drop-shadow(0 0 2rem var(--glossy-red)) blur(1px);
-moz-filter: drop-shadow(0 0 2rem var(--glossy-red)) blur(1px);
-o-filter: drop-shadow(0 0 2rem var(--glossy-red)) blur(1px);
-ms-filter: drop-shadow(0 0 2rem var(--glossy-red)) blur(1px);
}
/* planets */
article #mercury
{
position: fixed;
z-index: 99;
top: 38px;
display: flex;
width: 24.397px; /* β real radius of mercury: 24397km */
height: 24.397px;
/* β rotation period of mercury: 58.645 days */
-webkit-animation: planets-rotation 29.3225s linear infinite;
-moz-animation: planets-rotation 29.3225s linear infinite;
-ms-animation: planets-rotation 29.3225s linear infinite;
-o-animation: planets-rotation 29.3225s linear infinite;
animation: planets-rotation 29.3225s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--planets-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: var(--hidden-red);
justify-content: center;
align-items: center;
}
article #venus
{
position: fixed;
z-index: 99;
top: 15px;
display: flex;
width: 60.518px; /* β real radius of venus: 60518km */
height: 60.518px;
/* β rotation period of venus 243.023 days */
-webkit-animation: planets-rotation 121.513s linear infinite;
-moz-animation: planets-rotation 121.513s linear infinite;
-ms-animation: planets-rotation 121.513s linear infinite;
-o-animation: planets-rotation 121.513s linear infinite;
animation: planets-rotation 121.513s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--planets-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: var(--hidden-red);
justify-content: center;
align-items: center;
}
article #earth
{
position: fixed;
z-index: 99;
top: 35px;
display: flex;
width: 63.71px; /* β real radius of the earth: 6371km */
height: 63.71px;
/* β animation-duration: .5s = 24hours on earth */
-webkit-animation: planets-rotation .4874s linear infinite;
-moz-animation: planets-rotation .4874s linear infinite;
-ms-animation: planets-rotation .4874s linear infinite;
-o-animation: planets-rotation .4874s linear infinite;
animation: planets-rotation .4874s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--planets-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: var(--hidden-red);
justify-content: center;
align-items: center;
}
article #earth::after
{
position: inherit;
width: 40%;
height: 40%;
content: '';
-webkit-animation: earth-blinking 2s linear infinite;
-moz-animation: earth-blinking 2s linear infinite;
-ms-animation: earth-blinking 2s linear infinite;
-o-animation: earth-blinking 2s linear infinite;
animation: earth-blinking 2s linear infinite;
-webkit-border-radius: inherit;
-moz-border-radius: inherit;
border-radius: inherit;
background: var(--glossy-red);
-webkit-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
-moz-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
-o-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
-ms-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
}
article #mars
{
position: fixed;
z-index: 99;
top: 288px;
display: flex;
width: 33.895px; /* β real radius of mars: 33895km */
height: 33.895px;
/* β animation-duration: .5s = 24hours on earth */
-webkit-animation: planets-rotation .5128s linear infinite;
-moz-animation: planets-rotation .5128s linear infinite;
-ms-animation: planets-rotation .5128s linear infinite;
-o-animation: planets-rotation .5128s linear infinite;
animation: planets-rotation .5128s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--planets-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: var(--hidden-red);
justify-content: center;
align-items: center;
}
article #mars::after,
article #venus::after,
article #mercury::after
{
width: 40%;
height: 40%;
content: '';
-webkit-border-radius: inherit;
-moz-border-radius: inherit;
border-radius: inherit;
background: var(--glossy-red);
-webkit-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
-moz-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
-o-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
-ms-filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
}
/* planets trajectory's
β the distances between the planets and the sun are not respected here because of the diameter ot it */
section #mercury-trajectory
{
position: fixed;
z-index: 98;
width: 203.085px; /* β non-proportional */
height: 203.085px;
/* β revolution of mercury: 87.969 days */
-webkit-animation: solar-revolution 43.9845s linear infinite;
-moz-animation: solar-revolution 43.9845s linear infinite;
-ms-animation: solar-revolution 43.9845s linear infinite;
-o-animation: solar-revolution 43.9845s linear infinite;
animation: solar-revolution 43.9845s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--paths-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
section #venus-trajectory
{
position: fixed;
z-index: 98;
width: 257.085px; /* β non-proportional */
height: 257.085px;
/* β revolution of venus: 224.667 days */
-webkit-animation: solar-revolution 112.3335s linear infinite;
-moz-animation: solar-revolution 112.3335s linear infinite;
-ms-animation: solar-revolution 112.3335s linear infinite;
-o-animation: solar-revolution 112.3335s linear infinite;
animation: solar-revolution 112.3335s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--paths-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
section #earth-trajectory
{
position: fixed;
z-index: 98;
width: 332.085px; /* β non-proportional */
height: 332.085px;
/* β revolution of the earth: 365.2422 days */
-webkit-animation: solar-revolution 182.6211s linear infinite;
-moz-animation: solar-revolution 182.6211s linear infinite;
-ms-animation: solar-revolution 182.6211s linear infinite;
-o-animation: solar-revolution 182.6211s linear infinite;
animation: solar-revolution 182.6211s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--paths-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
section #mars-trajectory
{
position: fixed;
z-index: 98;
width: 446.085px; /* β non-proportional */
height: 446.085px;
/* β revolution of mars: 686.885 days */
-webkit-animation: solar-revolution 343.4425s linear infinite;
-moz-animation: solar-revolution 343.4425s linear infinite;
-ms-animation: solar-revolution 343.4425s linear infinite;
-o-animation: solar-revolution 343.4425s linear infinite;
animation: solar-revolution 343.4425s linear infinite;
border-width: 2px;
border-style: solid;
border-color: var(--paths-theme);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
/*
ββββββββββββ ANIMATIONS ββββββββββββ
*/
@keyframes solar-revolution
{
to
{
transform: rotate(360deg) ;
}
}
@keyframes planets-rotation
{
to
{
transform: rotate(360deg) ;
}
}
@keyframes earth-blinking
{
from
{
background-color: var(--glossy-red);
filter: drop-shadow(0 0 .3rem var(--light-red)) blur(.5px);
}
to
{
background-color: var(--dark-color);
filter: drop-shadow(0 0 0 var(--light-red)) blur(0);
}
}
/* media queries
smartphone*/
@media only screen and (max-width: 768px)
{
section #sun
{
width: 87.0425px;
height: 87.0425px;
}
section #mercury-trajectory
{
width: 101.5425px;
height: 101.5425px;
}
article #mercury
{
top: 17px;
width: 12.1985px;
height: 12.1985px;
}
section #venus-trajectory
{
width: 128.5425px;
height: 128.5425px;
}
article #venus
{
top: 6px;
width: 30.259px;
height: 30.259px;
}
section #earth-trajectory
{
width: 166.0425px;
height: 166.0425px;
}
article #earth
{
top: 16px;
width: 31.855px;
height: 31.855px;
}
section #mars-trajectory
{
width: 223.0425px;
height: 223.0425px;
}
article #mars
{
top: 56px;
width: 16.9475px;
height: 16.9475px;
}
}
/* 4K Ultra HD */
@media only screen and (min-width: 1921px)
{
section #sun
{
width: 348.17px;
height: 348.17px;
}
section #mercury-trajectory
{
width: 406.17px;
height: 406.17px;
}
article #mercury
{
top: 82px;
width: 48.794px; /* β real diameter of mercury: 4879.4km*/
height: 48.794px;
}
section #venus-trajectory
{
width: 514.17px;
height: 514.17px;
}
article #venus
{
top: 28px;
width: 121.036px; /* β real diameter of venus: 12103.6km */
height: 121.036px;
}
section #earth-trajectory
{
width: 664.17px;
height: 664.17px;
}
article #earth
{
top: 68px;
width: 127.42px; /* β real diameter of the earth: 12742km */
height: 127.42px;
}
section #mars-trajectory
{
width: 892.14px;
height: 892.14px;
}
article #mars
{
top: 242px;
width: 67.79px; /* β real diameter of mars: 6779km */
height: 67.79px;
}
}
/*
8K Ultra HD ...(*οΏ£οΌοΏ£)γ
@media only screen and (min-width: 3841px) {}
*/
Also see: Tab Triggers