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='container'>
<div class='ct-inner'>
<!-- Project HTML Below -->
<div class='calculator'>
<div class='inner'>
<div class='innerIn'>
<div class='screen active'>
<div class='output'>0</div>
<div class='output line2'>-</div>
<div class='output line3'>-</div>
<div class='screen-layer'></div>
</div>
<div class='controls'>
<div class='num-pad'>
<div class='button numbers small'>1</div>
<div class='button numbers small'>2</div>
<div class='button numbers small'>3</div>
<div class='button numbers small'>4</div>
<div class='button numbers small'>5</div>
<div class='button numbers small'>6</div>
<div class='button numbers small'>7</div>
<div class='button numbers small'>8</div>
<div class='button numbers small'>9</div>
<div class='button numbers big zeroBtn btnLeftAligned'>0</div>
<div class='button numbers small'>.</div>
</div>
<div class='control-pad operator-pad1'>
<div class='button med oper'>+</div>
<div class='button med oper'>-</div>
<div class='button med oper'>÷</div>
<div class='button med oper'>=</div>
</div>
</div>
</div> <!-- Inner in End -->
</div>
</div>
<!-- Project HTML Above -->
<div class='by-dev'>
<span class='by-text'>by</span>
<span class='by-val'>Deepak Kamat</span>
<span class='by-site'><a href='http://www.stramaxon.com'>stramaxon.com</a></span>
</div>
</div>
</div>
/* Page Layout CSS */
htm, body {
background-color:#000;
background: rgb(114,114,114); /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, rgba(114,114,114,1) 0%, rgba(30,30,30,1) 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(114,114,114,1)), color-stop(100%,rgba(30,30,30,1))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, rgba(114,114,114,1) 0%,rgba(30,30,30,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, rgba(114,114,114,1) 0%,rgba(30,30,30,1) 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(114,114,114,1) 0%,rgba(30,30,30,1) 100%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(114,114,114,1) 0%,rgba(30,30,30,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#727272', endColorstr='#1e1e1e',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
html {
height: auto;
}
body {
font:16px normal normal "Open Sans", sans-serif;
margin:0px;
color:#fff;
}
.container {padding:20px;margin:0 auto;}
.calculator {margin:0 auto;} /* Centering */
.calculator {box-shadow:inset 0px 0px 40px rgba(0,0,0,0.1), 30px 30px 60px rgba(0,0,0,0.5) !important;}
/* Calculator CSS */
.calculator {
width:400px;
min-height:500px;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
border:1px solid #ccc;
border-radius:5px;
box-shadow:inset 0px 0px 40px rgba(0,0,0,0.1);
background: rgb(183,183,183); /* Old browsers */
background: -moz-linear-gradient(left, rgba(183,183,183,1) 1%, rgba(201,201,201,1) 52%, rgba(160,160,160,1) 100%, rgba(196,196,196,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(183,183,183,1)), color-stop(52%,rgba(201,201,201,1)), color-stop(100%,rgba(160,160,160,1)), color-stop(100%,rgba(196,196,196,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(183,183,183,1) 1%,rgba(201,201,201,1) 52%,rgba(160,160,160,1) 100%,rgba(196,196,196,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(183,183,183,1) 1%,rgba(201,201,201,1) 52%,rgba(160,160,160,1) 100%,rgba(196,196,196,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(183,183,183,1) 1%,rgba(201,201,201,1) 52%,rgba(160,160,160,1) 100%,rgba(196,196,196,1) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(183,183,183,1) 1%,rgba(201,201,201,1) 52%,rgba(160,160,160,1) 100%,rgba(196,196,196,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b7b7b7', endColorstr='#c4c4c4',GradientType=1 ); /* IE6-9 */
}
.calculator .inner {
padding:10px;
}
.calculator .screen {
padding:5px 10px;
font-size:24px;
border-radius:5px /* 5px 0px 0px */;
color:#fff;
border:1px solid #195739;
position:relative;
background-color:#2A8358;
margin-bottom:10px;
text-align:right;
box-shadow:inset 0px 2px 2px rgba(0,0,0,0.7), 0px 2px 1px #eee;
}
.screen .output {
position:relative;
text-shadow:0px 0px 2px #DFFF5F;
}
.screen .screen-layer {
position:absolute;
border-radius:5px;
top:0px;right:0px;left:0px;bottom:0px;
background: -moz-linear-gradient(top, rgba(174,188,191,0.29) 0%, rgba(117,124,122,0.19) 50%, rgba(10,14,10,0.19) 51%, rgba(10,8,9,0.08) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(174,188,191,0.29)), color-stop(50%,rgba(117,124,122,0.19)), color-stop(51%,rgba(10,14,10,0.19)), color-stop(100%,rgba(10,8,9,0.08))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(174,188,191,0.29) 0%,rgba(117,124,122,0.19) 50%,rgba(10,14,10,0.19) 51%,rgba(10,8,9,0.08) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(174,188,191,0.29) 0%,rgba(117,124,122,0.19) 50%,rgba(10,14,10,0.19) 51%,rgba(10,8,9,0.08) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(174,188,191,0.29) 0%,rgba(117,124,122,0.19) 50%,rgba(10,14,10,0.19) 51%,rgba(10,8,9,0.08) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(174,188,191,0.29) 0%,rgba(117,124,122,0.19) 50%,rgba(10,14,10,0.19) 51%,rgba(10,8,9,0.08) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4aaebcbf', endColorstr='#140a0809',GradientType=0 ); /* IE6-9 */
}
/* Button */
.calculator .button {
font-size:18px;
margin:4px 2px;
text-align:center;
width:80px;
background-color:#ccc;
color:#111;
border:1px solid ;
box-sizing:border-box;
background: rgb(242,242,242); /* Old browsers */
background: -moz-linear-gradient(top, rgba(242,242,242,1) 0%, rgba(219,219,219,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(242,242,242,1)), color-stop(100%,rgba(219,219,219,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(242,242,242,1) 0%,rgba(219,219,219,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(242,242,242,1) 0%,rgba(219,219,219,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(242,242,242,1) 0%,rgba(219,219,219,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(242,242,242,1) 0%,rgba(219,219,219,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f2f2', endColorstr='#dbdbdb',GradientType=0 ); /* IE6-9 */
border:0px solid #eee;
box-shadow:0px 0px 3px #000, 0px 2px 1px #fff,inset 0px 3px 1px #fff, inset 0px 0px 2px #999;
border-radius:5px;
cursor:pointer;
font-weight:800;
text-shadow:1px 0px 0px #fff;
}
.calculator .button:active {
box-shadow:0px 0px 3px #000, 0px 2px 1px #fff,inset 0px 1px 2px #999, inset 0px 0px 2px #eee;
}
.calculator .button.btnLeftAligned {
text-align:left;
padding-left:35px;
}
/* Numbad */
.num-pad {
display:inline-block;
max-width:262px;
vertical-align:top;
}
.num-pad .button {
display:inline-block;
padding:5px 0px;
}
.num-pad .zeroBtn {
width:169px;
}
/* Operator Pad Num 1 */
.operator-pad1 {
display:inline-block;
vertical-align:top;
width:108px;
}
.operator-pad1 .button:first-child{margin-top:4px;}
.operator-pad1 .button {
width:109px;
padding:5px 0px;
margin:8px 2px;
}
.by-dev {text-align:center;margin:20px 0;}
.by-dev span {font-family:"Segoe UI",Arial,sans-serif;}
.by-dev .by-text {font-size:30px;display:block;opacity:0.5;}
.by-dev .by-val {font-size:80px;display:block;opacity:0.2;
text-shadow:0 0 30px rgba(255,255,255,0.7),1px 1px 0px #000;
}
.by-site a {color:#fff;text-decoration:none;color:rgba(255,255,255,0.4);
border-bottom:1px solid #999;
}
Also see: Tab Triggers