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 id="keyboard">
<ul class="cf">
<li><a href="#" class="key c27 fn"><span id="esc">esc</span></a></li>
<li><a href="#" class="key c112 fn"><span>F1</span></a></li>
<li><a href="#" class="key c113 fn"><span>F2</span></a></li>
<li><a href="#" class="key c114 fn"><span>F3</span></a></li>
<li><a href="#" class="key c115 fn"><span>F4</span></a></li>
<li><a href="#" class="key c116 fn"><span>F5</span></a></li>
<li><a href="#" class="key c117 fn"><span>F6</span></a></li>
<li><a href="#" class="key c118 fn"><span>F7</span></a></li>
<li><a href="#" class="key c119 fn"><span>F8</span></a></li>
<li><a href="#" class="key c120 fn"><span>F9</span></a></li>
<li><a href="#" class="key c121 fn"><span>F10</span></a></li>
<li><a href="#" class="key c122 fn"><span>F11</span></a></li>
<li><a href="#" class="key c123 fn"><span>F12</span></a></li>
<li><a href="#" class="key fn"><span>Eject</span></a></li>
</ul>
<ul class="cf" id="numbers">
<li><a href="#" class="key c192"><b>~</b><span>`</span></a></li>
<li><a href="#" class="key c49"><b>!</b><span>1</span></a></li>
<li><a href="#" class="key c50"><b>@</b><span>2</span></a></li>
<li><a href="#" class="key c51"><b>#</b><span>3</span></a></li>
<li><a href="#" class="key c52"><b>$</b><span>4</span></a></li>
<li><a href="#" class="key c53"><b>%</b><span>5</span></a></li>
<li><a href="#" class="key c54"><b>^</b><span>6</span></a></li>
<li><a href="#" class="key c55"><b>&</b><span>7</span></a></li>
<li><a href="#" class="key c56"><b>*</b><span>8</span></a></li>
<li><a href="#" class="key c57"><b>(</b><span>9</span></a></li>
<li><a href="#" class="key c48"><b>)</b><span>0</span></a></li>
<li><a href="#" class="key c189 alt"><b>_</b><span>-</span></a></li>
<li><a href="#" class="key c187"><b>+</b><span>=</span></a></li>
<li><a href="#" class="key c46" id="delete"><span>Delete</span></a></li>
</ul>
<ul class="cf" id="qwerty">
<li><a href="#" class="key c9" id="tab"><span>tab</span></a></li>
<li><a href="#" class="key c81"><span>q</span></a></li>
<li><a href="#" class="key c87"><span>w</span></a></li>
<li><a href="#" class="key c69"><span>e</span></a></li>
<li><a href="#" class="key c82"><span>r</span></a></li>
<li><a href="#" class="key c84"><span>t</span></a></li>
<li><a href="#" class="key c89"><span>y</span></a></li>
<li><a href="#" class="key c85"><span>u</span></a></li>
<li><a href="#" class="key c73"><span>i</span></a></li>
<li><a href="#" class="key c79"><span>o</span></a></li>
<li><a href="#" class="key c80"><span>p</span></a></li>
<li><a href="#" class="key c219 alt"><b>{</b><span>[</span></a></li>
<li><a href="#" class="key c221 alt"><b>}</b><span>]</span></a></li>
<li><a href="#" class="key c220 alt"><b>|</b><span>\</span></a></li>
</ul>
<ul class="cf" id="asdfg">
<li><a href="#" class="key c20 alt" id="caps"><b></b><span>caps lock</span></a></li>
<li><a href="#" class="key c65"><span>a</span></a></li>
<li><a href="#" class="key c83"><span>s</span></a></li>
<li><a href="#" class="key c68"><span>d</span></a></li>
<li><a href="#" class="key c70"><span>f</span></a></li>
<li><a href="#" class="key c71"><span>g</span></a></li>
<li><a href="#" class="key c72"><span>h</span></a></li>
<li><a href="#" class="key c74"><span>j</span></a></li>
<li><a href="#" class="key c75"><span>k</span></a></li>
<li><a href="#" class="key c76"><span>l</span></a></li>
<li><a href="#" class="key c186 alt"><b>:</b><span>;</span></a></li>
<li><a href="#" class="key c222 alt"><b>"</b><span>'</span></a></li>
<li><a href="#" class="key c13 alt" id="enter"><span>return</span></a></li>
</ul>
<ul class="cf" id="zxcvb">
<li><a href="#" class="key c16 shiftleft"><span>Shift</span></a></li>
<li><a href="#" class="key c90"><span>z</span></a></li>
<li><a href="#" class="key c88"><span>x</span></a></li>
<li><a href="#" class="key c67"><span>c</span></a></li>
<li><a href="#" class="key c86"><span>v</span></a></li>
<li><a href="#" class="key c66"><span>b</span></a></li>
<li><a href="#" class="key c78"><span>n</span></a></li>
<li><a href="#" class="key c77"><span>m</span></a></li>
<li><a href="#" class="key c188 alt"><b><</b><span>,</span></a></li>
<li><a href="#" class="key c190 alt"><b>></b><span>.</span></a></li>
<li><a href="#" class="key c191 alt"><b>?</b><span>/</span></a></li>
<li><a href="#" class="key c16 shiftright"><span>Shift</span></a></li>
</ul>
<ul class="cf" id="bottomrow">
<li><a href="#" class="key" id="fn"><span>fn</span></a></li>
<li><a href="#" class="key c17" id="control"><span>control</span></a></li>
<li><a href="#" class="key option" id="optionleft"><span>option</span></a></li>
<li><a href="#" class="key command" id="commandleft"><span>command</span></a></li>
<li><a href="#" class="key c32" id="spacebar"></a></li>
<li><a href="#" class="key command" id="commandright"><span>command</span></a></li>
<li><a href="#" class="key option" id="optionright"><span>option</span></a></li>
<ol class="cf">
<li><a href="#" class="key c37" id="left"><span>◂</span></a></li>
<li>
<a href="#" class="key c38" id="up"><span>▴</span></a>
<a href="#" class="key c40" id="down"><span>▾</span></a>
</li>
<li><a href="#" class="key c39" id="right"><span>▸</span></a></li>
</ol>
</ul>
</div>
<cite>
</cite>
body {background: #333;}
#keyboard {
margin: 50px auto;
width: 794px;
height: 315px;
background: #d5d9dc url('') repeat-x;
-moz-border-radius-topleft: 7px 21px;
-moz-border-radius-topright: 7px 21px;
-moz-border-radius-bottomright: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-left-radius: 7px 21px;
border-top-right-radius: 7px 21px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
padding: 50px 0 0 10px;
-webkit-box-shadow:
inset 0 0 8px #bbb,
0 1px 0 #aaa,
0 4px 0 #bbb,
0 10px 30px #111;
-moz-box-shadow:
inset 0 0 8px #bbb,
0 1px 0 #aaa,
0 4px 0 #bbb,
0 10px 30px #111;
box-shadow:
inset 0 0 8px #bbb,
0 1px 0 #aaa,
0 4px 0 #bbb,
0 10px 30px #111;}
ul {list-style-type: none; width: 784px; margin: 0 auto;}
li {float: left;}
.key{
display: block;
color: #aaa;
font: bold 9pt arial;
text-decoration: none;
text-align: center;
width: 44px;
height: 41px;
margin: 5px;
background: #222;
-moz-border-radius: 4px;
border-radius: 4px;
border-top: 1px solid #222;
-webkit-box-shadow:
inset 0 0 25px #333,
0 1px 0 #000,
0 2px 0 #222,
0 2px 3px #333;
-moz-box-shadow:
inset 0 0 25px #333,
0 1px 0 #000,
0 2px 0 #222,
0 2px 3px #333;
box-shadow:
inset 0 0 25px #333,
0 1px 0 #000,
0 2px 0 #222,
0 2px 3px #333;
text-shadow: 0px -1px 0px #000;}
.key:active, .keydown {
color: #888;
background: #222;
margin: 7px 5px 3px;
-webkit-box-shadow:
inset 0 0 25px #333,
0 0 3px #333;
-moz-box-shadow:
inset 0 0 25px #333,
0 0 3px #333;
box-shadow:
inset 0 0 25px #333,
0 0 3px #333;
border-top: 1px solid #000;}
.fn span {
display: block;
margin: 14px 5px 0 0;
text-align: right;
font: bold 6pt arial;
text-transform: uppercase;}
#esc {
margin: 6px 15px 0 0;
font-size: 7.5pt;
text-transform: lowercase;}
#numbers li a span {
display: block;}
#numbers li a b {
margin: 3px 0 3px;
display: block;}
#numbers li .alt b {display: block;margin: 0 0 3px;}
#numbers li #delete span {
text-align: right;
margin: 23px 10px 0 0;
font-size: 7.5pt;
text-transform: lowercase;}
#qwerty li a span {
display: block;
margin: 13px 0 0;
text-transform: uppercase;}
#qwerty li #tab span {
text-align: left;
margin: 23px 0 0 10px;
font-size: 7.5pt;
text-transform: lowercase;}
#qwerty li .alt b {display: block; margin: 3px 0 0;}
#qwerty li .alt span {margin: 2px 0 0;}
#asdfg li a span {
display: block;
margin: 13px 0 0;
text-transform: uppercase;}
#asdfg li .alt span {margin: 0; text-transform: lowercase;}
#asdfg li .alt b {display: block; margin: 3px 0 0;}
#asdfg li #caps b {
display: block;
background: #999;
width: 4px;
height: 4px;
border-radius: 10px;
margin: 9px 0 0 10px;
-webkit-box-shadow: inset 0 1px 0 #666;
-moz-box-shadow:inset 0 1px 0 #666;
box-shadow:inset 0 1px 0 #666;}
#asdfg li #caps span {
text-align: left;
margin: 10px 0 0 10px;
font-size: 7.5pt;}
#asdfg li #enter span {
text-align: right;
margin: 23px 10px 0 0;
font-size: 7.5pt;}
#zxcvb li a span {
display: block;
margin: 13px 0 0;
text-transform: uppercase;}
#zxcvb li .shiftleft span {
text-align: left;
margin: 23px 0 0 10px;
font-size: 7.5pt;
text-transform: lowercase;}
#zxcvb li .shiftright span {
text-align: right;
margin: 23px 10px 0 0;
font-size: 7.5pt;
text-transform: lowercase;}
#zxcvb li .alt b {display: block;margin: 4px 0 0;}
#zxcvb li .alt span {margin: 0;}
#bottomrow li #fn span, #bottomrow li #control span, #bottomrow li #optionleft span, #bottomrow li #commandleft span {
display: block;
text-align: left;
margin: 31px 0 0 8px;
font-size: 7.5pt;
text-transform: lowercase;}
#bottomrow li #optionright span, #bottomrow li #commandright span {
display: block;
text-align: right;
margin: 31px 8px 0 0;
font-size: 7.5pt;
text-transform: lowercase;}
#bottomrow ol li #left span, #bottomrow ol li #right span, #bottomrow ol li #up span, #bottomrow ol li #down span {
display: block;
margin: 9px 0 0;}
.fn {height: 26px; width: 46px;}
#delete {width: 72px;}
#tab {width: 72px;}
#caps {width: 85px;}
#enter {width: 85px;}
.shiftleft, .shiftright {width: 112px;}
#fn, #control, .option, .command, #spacebar {height: 49px;}
#control {width: 56px;}
.option {width: 46px;}
.command {width: 67px;}
#spacebar {width: 226px;}
#left img, #up img, #down img, #right img {border: none;}
ul ol {list-style-type: none;}
#down {height: 23px;}
#up, #left, #right {height: 24px;}
#left, #right {margin: 30px 5px 5px;}
#left:active, #right:active {margin: 32px 5px 3px;}
#up {margin: 5px 5px 1px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;}
#up:active {margin: 8px 5px -2px;}
#down {margin: 0 5px 5px; border-top-left-radius: 0px; border-top-right-radius: 0px;}
#down:Active {margin: 3px 5px 4px;}
#main {
width: 700px;
padding: 20px 50px;
margin: 0 auto 50px;
background: #fff;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px #aaa;}
h1 {
color: #888;
text-align: center;
font: bold 25pt/25pt arial;
margin: 30px 0 60px;}
h2 {
color: #666;
font: 13pt/0pt arial;}
p {
color: #999;
font: 9pt/17pt arial;
margin: 0 0 50px;}
small {
font: italic 8pt/12pt arial;
color: #aaa;
padding: 0 130px 0 0;
display: block;}
cite {
display: block;
padding: 0 0 30px;
margin: 0 auto;
text-align: center;
color: #ccc;
font: italic bold 8pt arial;}
cite a {
color: #e5e5e5;
text-decoration: underline;}
#main a {color: #007fff;}
ul, ol {padding: 0px; margin: 0;}
/* Micro Clearfix by Nicolas Gallagher - http://nicolasgallagher.com/micro-clearfix-hack */
/* For modern browsers */
.cf:before, .cf:after {content:""; display:table;}
.cf:after {clear:both;}
/* For IE 6/7 (trigger hasLayout) */
.cf {zoom:1;}
Also see: Tab Triggers