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.
<div class="ninja"></div>
@import "compass/css3";
@import url(https://fonts.googleapis.com/css?family=Sarina);
/* Choose your size */
$size: 9px;
/* SASS function - centering */
@function calc-width($s) {
@return ($size*17);
}
@function calc-height($s) {
@return ($size*23);
}
html {
height: 100%;
}
body {
@include background(radial-gradient(center 0, circle cover, #fff, #999) no-repeat);
background-color: #ddd;
height: 100%;
}
.ninja {
width: calc-width($size);
height: calc-height($size);
margin: 20px auto;
position: relative;
font-size: $size;
}
.ninja:after {
content: "Code Ninjas";
color: black;
font-family: 'Sarina', cursive;
text-align: center;
position: absolute;
font-size: 7em;
left: 50%;
bottom: -1.5em;
width: 8em;
margin-left: -4em;
}
.ninja:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 1em;
height: 1em;
box-shadow:
2em 0,
1em 1em,
2em 1em,
1em 2em,
2em 2em,
1em 3em,
2em 3em,
6em 3em,
7em 3em,
8em 3em,
9em 3em,
10em 3em,
11em 3em,
12em 3em,
1em 4em,
2em 4em,
5em 4em,
6em 4em #555,
7em 4em #555,
8em 4em #555,
9em 4em #555,
10em 4em #555,
11em 4em #555,
12em 4em #555,
13em 4em,
15em 4em,
16em 4em,
1em 5em,
2em 5em,
5em 5em,
6em 5em #555,
7em 5em,
8em 5em,
9em 5em,
10em 5em,
11em 5em,
12em 5em,
13em 5em,
14em 5em,
1em 6em,
2em 6em,
5em 6em,
6em 6em #555,
7em 6em #e9c190,
8em 6em,
9em 6em #e9c190,
10em 6em,
11em 6em #e9c190,
12em 6em,
13em 6em,
14em 6em,
15em 6em,
16em 6em,
1em 7em,
2em 7em,
5em 7em,
6em 7em #555,
7em 7em #e9c190,
8em 7em #ffe3bd,
9em 7em #e9c190,
10em 7em #ffe3bd,
11em 7em #ffe3bd,
12em 7em,
13em 7em,
1em 8em,
2em 8em,
5em 8em,
6em 8em #555,
7em 8em,
8em 8em,
9em 8em,
10em 8em,
11em 8em,
12em 8em,
13em 8em,
15em 8em,
1em 9em,
2em 9em,
6em 9em,
7em 9em #555,
8em 9em #555,
9em 9em #555,
10em 9em,
11em 9em,
12em 9em,
14em 9em,
15em 9em #555,
16em 9em,
0 10em,
1em 10em,
2em 10em,
3em 10em,
4em 10em,
5em 10em,
6em 10em #555,
7em 10em #555,
8em 10em #555,
9em 10em,
10em 10em,
11em 10em,
12em 10em,
13em 10em,
14em 10em #555,
15em 10em #555,
16em 10em,
0 11em,
1em 11em #555,
2em 11em,
3em 11em #555,
4em 11em #555,
5em 11em #555,
6em 11em #555,
7em 11em,
8em 11em,
9em 11em,
10em 11em,
11em 11em,
12em 11em #555,
13em 11em #555,
14em 11em,
15em 11em,
16em 11em,
0 12em,
1em 12em #555,
2em 12em,
3em 12em,
4em 12em,
5em 12em,
6em 12em,
7em 12em,
8em 12em,
9em 12em,
10em 12em,
11em 12em,
12em 12em,
13em 12em,
14em 12em,
15em 12em,
16em 12em,
1em 13em,
2em 13em,
3em 13em,
4em 13em,
5em 13em,
6em 13em,
7em 13em,
8em 13em,
9em 13em,
10em 13em,
11em 13em,
12em 13em,
13em 13em,
14em 13em,
15em 13em,
6em 14em #555,
7em 14em #555,
8em 14em,
9em 14em,
10em 14em,
11em 14em,
12em 14em,
6em 15em #fa0117,
7em 15em #a80002,
8em 15em #a80002,
9em 15em #a80002,
10em 15em,
11em 15em #fa0117,
12em 15em,
4em 16em,
5em 16em,
6em 16em #555,
7em 16em,
8em 16em,
9em 16em,
10em 16em,
11em 16em,
12em 16em #a80002,
13em 16em,
3em 17em,
4em 17em #555,
5em 17em,
6em 17em,
7em 17em,
8em 17em,
9em 17em,
10em 17em,
11em 17em,
12em 17em,
13em 17em #a80002,
14em 17em,
3em 18em,
4em 18em #555,
5em 18em,
6em 18em,
7em 18em,
8em 18em,
9em 18em,
10em 18em,
11em 18em,
12em 18em,
13em 18em,
2em 19em,
3em 19em #555,
4em 19em #555,
5em 19em,
10em 19em,
11em 19em,
12em 19em,
1em 20em,
2em 20em,
3em 20em,
4em 20em #555,
5em 20em,
10em 20em,
11em 20em #555,
12em 20em #555,
13em 20em,
1em 21em,
2em 21em,
3em 21em,
4em 21em,
5em 21em,
10em 21em,
11em 21em #555,
12em 21em,
13em 21em,
14em 21em,
10em 22em,
11em 22em,
12em 22em,
13em 22em,
14em 22em;
}
/* Inspired by Kristy Marcinová's work on Dribbble: http://dribbble.com/shots/736157-Code-Ninjas */
Also see: Tab Triggers