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.
<link href='https://fonts.googleapis.com/css?family=Josefin+Sans' rel='stylesheet' type='text/css'>
<h1>
<em>C</em>
<em class="planet left">O</em>
<em>S</em>
<em>M</em>
<em class="planet right">O</em>
<em>S</em>
</h1>
html {
margin: 0;
height: 100%;
}
body {
margin: 0;
height: 100%;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
background: black;
color: #ccc;
}
html::before,
html::after,
body::before,
body::after {
content: "";
position: absolute;
top: 0;
left: 0;
display: block;
width: .5vmin;
height: .5vmin;
border-radius: 50%;
color: transparent;
}
html::before {
box-shadow: 93vw 63vh .3vmin rgba(255,255,255,.8),
3vw 17vh .3vmin rgba(255,255,255,.8),
28vw 85vh .3vmin rgba(255,255,255,.8),
97vw 82vh .3vmin rgba(255,255,255,.8),
55vw 83vh .3vmin rgba(255,255,255,.8),
74vw 72vh .3vmin rgba(255,255,255,.8),
84vw 11vh .3vmin rgba(255,255,255,.8),
32vw 6vh .3vmin rgba(255,255,255,.8),
45vw 92vh .3vmin rgba(255,255,255,.8),
98vw 57vh .3vmin rgba(255,255,255,.8),
63vw 98vh .3vmin rgba(255,255,255,.8),
90vw 46vh .3vmin rgba(255,255,255,.8),
50vw 86vh .3vmin rgba(255,255,255,.8),
38vw 21vh .3vmin rgba(255,255,255,.8),
74vw 2vh .3vmin rgba(255,255,255,.8),
89vw 22vh .3vmin rgba(255,255,255,.8),
39vw 0vh .3vmin rgba(255,255,255,.8),
25vw 89vh .3vmin rgba(255,255,255,.8),
54vw 58vh .3vmin rgba(255,255,255,.8),
81vw 39vh .3vmin rgba(255,255,255,.8),
51vw 8vh .3vmin rgba(255,255,255,.8),
24vw 56vh .3vmin rgba(255,255,255,.8),
50vw 23vh .3vmin rgba(255,255,255,.8),
62vw 34vh .3vmin rgba(255,255,255,.8),
10vw 77vh .3vmin rgba(255,255,255,.8),
92vw 45vh .3vmin rgba(255,255,255,.8),
70vw 40vh .3vmin rgba(255,255,255,.8),
2vw 53vh .3vmin rgba(255,255,255,.8),
3vw 54vh .3vmin rgba(255,255,255,.8),
18vw 21vh .3vmin rgba(255,255,255,.8),
48vw 47vh .3vmin rgba(255,255,255,.8),
83vw 96vh .3vmin rgba(255,255,255,.8),
26vw 32vh .3vmin rgba(255,255,255,.8),
46vw 9vh .3vmin rgba(255,255,255,.8),
2vw 13vh .3vmin rgba(255,255,255,.8),
29vw 63vh .3vmin rgba(255,255,255,.8),
17vw 90vh .3vmin rgba(255,255,255,.8),
78vw 9vh .3vmin rgba(255,255,255,.8),
15vw 39vh .3vmin rgba(255,255,255,.8),
90vw 5vh .3vmin rgba(255,255,255,.8);
}
html::after {
box-shadow: 67vw 35vh .2vmin .1vmin rgba(255,200,200,.8),
89vw 13vh .2vmin .1vmin rgba(255,200,200,.8),
77vw 62vh .2vmin .1vmin rgba(255,200,200,.8),
1vw 74vh .2vmin .1vmin rgba(255,200,200,.8),
38vw 15vh .2vmin .1vmin rgba(255,200,200,.8),
79vw 10vh .2vmin .1vmin rgba(255,200,200,.8),
16vw 47vh .2vmin .1vmin rgba(255,200,200,.8),
74vw 71vh .2vmin .1vmin rgba(255,200,200,.8),
30vw 96vh .2vmin .1vmin rgba(255,200,200,.8),
13vw 98vh .2vmin .1vmin rgba(255,200,200,.8),
9vw 40vh .2vmin .1vmin rgba(255,200,200,.8),
9vw 71vh .2vmin .1vmin rgba(255,200,200,.8),
12vw 93vh .2vmin .1vmin rgba(255,200,200,.8),
91vw 26vh .2vmin .1vmin rgba(255,200,200,.8),
73vw 48vh .2vmin .1vmin rgba(255,200,200,.8),
61vw 46vh .2vmin .1vmin rgba(255,200,200,.8),
20vw 3vh .2vmin .1vmin rgba(255,200,200,.8),
90vw 59vh .2vmin .1vmin rgba(255,200,200,.8),
48vw 72vh .2vmin .1vmin rgba(255,200,200,.8),
91vw 68vh .2vmin .1vmin rgba(255,200,200,.8);
}
body::before {
box-shadow: 30vw 90vh .2vmin rgba(190,200,255,.9),
93vw 64vh .2vmin rgba(190,200,255,.9),
75vw 80vh .2vmin rgba(190,200,255,.9),
37vw 24vh .2vmin rgba(190,200,255,.9),
83vw 58vh .2vmin rgba(190,200,255,.9),
12vw 36vh .2vmin rgba(190,200,255,.9),
62vw 82vh .2vmin rgba(190,200,255,.9),
87vw 91vh .2vmin rgba(190,200,255,.9),
9vw 2vh .2vmin rgba(190,200,255,.9),
99vw 46vh .2vmin rgba(190,200,255,.9),
39vw 86vh .2vmin rgba(190,200,255,.9),
48vw 42vh .2vmin rgba(190,200,255,.9),
53vw 24vh .2vmin rgba(190,200,255,.9),
63vw 42vh .2vmin rgba(190,200,255,.9),
2vw 53vh .2vmin rgba(190,200,255,.9),
67vw 11vh .2vmin rgba(190,200,255,.9),
32vw 44vh .2vmin rgba(190,200,255,.9),
0vw 82vh .2vmin rgba(190,200,255,.9),
51vw 47vh .2vmin rgba(190,200,255,.9),
74vw 30vh .2vmin rgba(190,200,255,.9);
}
body::after {
box-shadow: 80vw 64vh .1vmin rgba(200,255,230,.7),
32vw 45vh .1vmin rgba(200,255,230,.7),
65vw 62vh .1vmin rgba(200,255,230,.7),
22vw 55vh .1vmin rgba(200,255,230,.7),
68vw 19vh .1vmin rgba(200,255,230,.7),
54vw 34vh .1vmin rgba(200,255,230,.7),
1vw 56vh .1vmin rgba(200,255,230,.7),
95vw 1vh .1vmin rgba(200,255,230,.7),
60vw 93vh .1vmin rgba(200,255,230,.7),
14vw 82vh .1vmin rgba(200,255,230,.7),
6vw 64vh .1vmin rgba(200,255,230,.7),
19vw 12vh .1vmin rgba(200,255,230,.7),
25vw 39vh .1vmin rgba(200,255,230,.7),
21vw 36vh .1vmin rgba(200,255,230,.7),
4vw 10vh .1vmin rgba(200,255,230,.7),
85vw 70vh .1vmin rgba(200,255,230,.7),
54vw 93vh .1vmin rgba(200,255,230,.7),
9vw 46vh .1vmin rgba(200,255,230,.7),
63vw 59vh .1vmin rgba(200,255,230,.7),
48vw 28vh .1vmin rgba(200,255,230,.7);
}
h1 {
margin: 0;
height: 12vmin;
width: 120vmin;
display: flex;
justify-content: center;
position: relative;
}
h1::before {
content: "";
display: block;
position: absolute;
z-index: -1;
top: -26vmin;
left: 29vmin;
width: 62vmin;
height: 62vmin;
border-radius: 50%;
border: 1.3vmin solid currentColor;
box-sizing: border-box;
}
em {
font-family: 'Josefin Sans', sans-serif;
color: currentColor;
font-size: 15vmin;
position: relative;
font-style: normal;
width: 20vmin;
text-align: center;
}
em.planet {
-webkit-animation: planet-rotate 4s linear infinite;
animation: planet-rotate 4s linear infinite;
position: relative;
}
em.planet::before {
content: "";
position: absolute;
top: -.5vmin;
left: 3.5vmin;
z-index: -1;
width: 13vmin;
height: 13vmin;
border-radius: 50%;
background: black;
}
em.planet.left {
-webkit-transform-origin: 40vmin 5vmin;
transform-origin: 40vmin 5vmin;
}
em.planet.right {
-webkit-transform-origin: -20vmin 5vmin;
transform-origin: -20vmin 5vmin;
}
@-webkit-keyframes planet-rotate {
to {
-webkit-transform: rotate(1turn);
}
}
@keyframes planet-rotate {
to {
transform: rotate(1turn);
}
}
Also see: Tab Triggers