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.
<a data-button href=#>anchor tag</a>
<input data-button type=button value="input button">
<input data-button type=submit value="input submit">
<label data-button>label</label>
<button data-button>button</button>
<button data-button disabled>disabled</button>
<br>
<a data-button=green href=#>anchor tag</a>
<input data-button=green type=button value="input button">
<input data-button=green type=submit value="input submit">
<label data-button=green>label</label>
<button data-button=green>button</button>
<button data-button=green disabled>disabled</button>
<br>
<a data-button=red href=#>anchor tag</a>
<input data-button=red type=button value="input button">
<input data-button=red type=submit value="input submit">
<label data-button=red>label</label>
<button data-button=red>button</button>
<button data-button=red disabled>disabled</button>
<br>
<a data-button=blue href+#>anchor tag</a>
<input data-button=blue type=button value="input button">
<input data-button=blue type=submit value="input submit">
<label data-button=blue>label</label>
<button data-button=blue>button</button>
<button data-button=blue disabled>disabled</button>
<br>
<a data-button=grey href=#>anchor tag</a>
<input data-button=grey type="button" value="input button">
<input data-button=grey type="submit" value="input submit">
<label data-button=grey>label</label>
<button data-button=grey>button</button>
<button data-button=grey disabled>disabled</button>
<br>
<a data-button=outline href=#>anchor tag</a>
<input data-button=outline type=button value="input button">
<input data-button=outline type=submit value="input submit">
<label data-button=outline>label</label>
<button data-button=outline>button</button>
<button data-button=outline disabled>disabled</button>
<h2>semiflat</h2>
<a data-button=semiflat href=#>anchor tag</a>
<input data-button=semiflat type=button value="input button">
<input data-button=semiflat type=submit value="input submit">
<label data-button=semiflat>label</label>
<button data-button=semiflat>button</button>
<button data-button=semiflat disabled>disabled</button>
<br>
<a data-button="green semiflat" href=#>anchor tag</a>
<input data-button="green semiflat" type=button value="input button">
<input data-button="green semiflat" type=submit value="input submit">
<label data-button="green semiflat">label</label>
<button data-button="green semiflat">button</button>
<button data-button="green semiflat" disabled>disabled</button>
<br>
<a data-button="red semiflat" href=#>anchor tag</a>
<input data-button="red semiflat" type=button value="input button">
<input data-button="red semiflat" type=submit value="input submit">
<label data-button="red semiflat">label</label>
<button data-button="red semiflat">button</button>
<button data-button="red semiflat" disabled>disabled</button>
<br>
<a data-button="blue semiflat" href+#>anchor tag</a>
<input data-button="blue semiflat" type=button value="input button">
<input data-button="blue semiflat" type=submit value="input submit">
<label data-button="blue semiflat">label</label>
<button data-button="blue semiflat">button</button>
<button data-button="blue semiflat" disabled>disabled</button>
<br>
<a data-button="grey semiflat" href=#>anchor tag</a>
<input data-button="grey semiflat" type="button" value="input button">
<input data-button="grey semiflat" type="submit" value="input submit">
<label data-button="grey semiflat">label</label>
<button data-button="grey semiflat">button</button>
<button data-button="grey semiflat" disabled>disabled</button>
<br>
<a data-button="outline semiflat" href=#>anchor tag</a>
<input data-button="outline semiflat" type=button value="input button">
<input data-button="outline semiflat" type=submit value="input submit">
<label data-button="outline semiflat">label</label>
<button data-button="outline semiflat">button</button>
<button data-button="outline semiflat" disabled>disabled</button>
/* The Mad CSScientist's Buttons */
[data-button] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-appearance: none;
appearance: none;
display: inline-block;
width: auto;
margin: .5em auto;
padding: .6em .6em .5em .6em;
text-decoration: none !important;
outline: none;
background: #ff8900 !important;
background: -moz-linear-gradient(top, #ff8900 0%, #ff3d00 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff8900), color-stop(100%,#ff3d00)) !important;
background: -webkit-linear-gradient(top, #ff8900 0%,#ff3d00 100%) !important;
background: -o-linear-gradient(top, #ff8900 0%,#ff3d00 100%) !important;
background: -ms-linear-gradient(top, #ff8900 0%,#ff3d00 100%) !important;
background: linear-gradient(to bottom, #ff8900 0%,#ff3d00 100%) !important;
font-family: 'Fira Sans', 'Source Sans Pro', 'Myriad Pro', 'Open Sans', Roboto, Myriad, 'Segoe UI', Helvetica, Arial, sans-serif;
font-weight: 500;
font-kerning: auto;
text-decoration: none;
text-align: center;
font-size: 14pt;
line-height: 1.2 !important;
vertical-align: -webkit-baseline-middle;
color: white !important;
text-shadow: #e20 1px 1px 0;
border-radius: 3px;
border: 1px solid #f60;
border-bottom-color: #e20;
box-shadow: inset #f20 0 -5px 15px, inset #fc6 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
cursor: pointer;
}
[data-button]:hover,
[data-button]:focus {
color: white !important;
background: #fa3 !important;
background: -moz-linear-gradient(top, #fa3 0%, #f30 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fa3), color-stop(100%,#f30)) !important;
background: -webkit-linear-gradient(top, #fa3 0%,#f30 100%) !important;
background: -o-linear-gradient(top, #fa3 0%,#f30 100%) !important;
background: -ms-linear-gradient(top, #fa3 0%,#f30 100%) !important;
background: linear-gradient(to bottom, #fa3 0%,#f30 100%) !important;
box-shadow: inset #f40 0 -5px 15px, inset #ffd28a 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px, rgba(255,200,0,.5) 0 0 10px;
}
[data-button]:active {
color: rgba(255,255,255,.9) !important;
background: #f50 !important;
border: 1px solid #f00;
border-bottom-color: #d10;
box-shadow: inset #f40 0 -5px 15px, inset #ffd28a 0 1px 1px;
}
/* Disabled & Hidden */
[data-button].disabled,
[data-button][hidden],
[data-button][disabled] {
opacity: .5;
pointer-events: none;
}
/* Blue Theme */
[data-button*=blue] {
background: #0cf !important;
background: -moz-linear-gradient(top, #0cf 0%, #0080ff 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0cf), color-stop(100%,#0080ff)) !important;
background: -webkit-linear-gradient(top, #0cf 0%,#0080ff 100%) !important;
background: -o-linear-gradient(top, #0cf 0%,#0080ff 100%) !important;
background: -ms-linear-gradient(top, #0cf 0%,#0080ff 100%) !important;
background: linear-gradient(to bottom, #0cf 0%,#0080ff 100%) !important;
text-shadow: #06e 1px 1px 0;
border: 1px solid #07f;
border-bottom-color: #02e;
box-shadow: inset #0065ff 0 -5px 15px, inset #99ffff 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px;
}
[data-button*=blue]:hover,
[data-button*=blue]:focus {
background: #7df !important;
background: -moz-linear-gradient(top, #7df 0%, #07f 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7df), color-stop(100%,#07f)) !important;
background: -webkit-linear-gradient(top, #7df 0%,#07f 100%) !important;
background: -o-linear-gradient(top, #7df 0%,#07f 100%) !important;
background: -ms-linear-gradient(top, #7df 0%,#07f 100%) !important;
background: linear-gradient(to bottom, #7df 0%,#07f 100%) !important;
box-shadow: inset #08f 0 -5px 15px, inset #cef 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px, rgba(0,200,255,.5) 0 0 10px;
}
[data-button*=blue]:active {
background: #05f !important;
border: 1px solid #00f;
border-bottom-color: #01d;
box-shadow: inset #04f 0 -5px 15px, inset #8ad2ff 0 1px 1px;
}
/* Green Theme */
[data-button*=green] {
background: #6a1 !important;
background: -moz-linear-gradient(top, #6a1 0%, #360 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6a1), color-stop(100%,#360)) !important;
background: -webkit-linear-gradient(top, #6a1 0%,#360 100%) !important;
background: -o-linear-gradient(top, #6a1 0%,#360 100%) !important;
background: -ms-linear-gradient(top, #6a1 0%,#360 100%) !important;
background: linear-gradient(to bottom, #6a1 0%,#360 100%) !important;
text-shadow: #062 1px 1px 0;
border: 1px solid #480;
border-bottom-color: #005822;
box-shadow: inset #072 0 -5px 15px, inset #8e8 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px;
}
[data-button*=green]:hover,
[data-button*=green]:focus {
background: #6d4 !important;
background: -moz-linear-gradient(top, #6d4 0%, #360 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6d4), color-stop(100%,#360)) !important;
background: -webkit-linear-gradient(top, #6d4 0%,#360 100%) !important;
background: -o-linear-gradient(top, #6d4 0%,#360 100%) !important;
background: -ms-linear-gradient(top, #6d4 0%,#360 100%) !important;
background: linear-gradient(to bottom, #6d4 0%,#360 100%) !important;
box-shadow: inset #064 0 -5px 15px, inset #8e8 0 1px 1px, rgba(0, 255, 75, 0.5) 0 0 10px, rgba(0,0,0,.15) 0px 1px 1px;
}
[data-button*=green]:active {
background: #340 !important;
border: 1px solid #005822;
border-bottom-color: #052;
box-shadow: inset #040 0 -5px 15px, inset #8e8 0 1px 1px;
}
/* Red Theme */
[data-button*=red] {
background: #a11 !important;
background: -moz-linear-gradient(top, #a11 0%, #800 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a11), color-stop(100%,#800)) !important;
background: -webkit-linear-gradient(top, #a11 0%,#800 100%) !important;
background: -o-linear-gradient(top, #a11 0%,#800 100%) !important;
background: -ms-linear-gradient(top, #a11 0%,#800 100%) !important;
background: linear-gradient(to bottom, #a11 0%,#800 100%) !important;
text-shadow: #600 1px 1px 0;
border: 1px solid #800;
border-bottom-color: #500;
box-shadow: inset #700 0 -5px 15px, inset #e88 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px;
}
[data-button*=red]:hover,
[data-button*=red]:focus {
background: #d44 !important;
background: -moz-linear-gradient(top, #d44 0%, #800 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d44), color-stop(100%,#800)) !important;
background: -webkit-linear-gradient(top, #d44 0%,#800 100%) !important;
background: -o-linear-gradient(top, #d44 0%,#800 100%) !important;
background: -ms-linear-gradient(top, #d44 0%,#800 100%) !important;
background: linear-gradient(to bottom, #d44 0%,#800 100%) !important;
box-shadow: inset #600 0 -5px 15px, inset #e88 0 1px 1px, rgba(255, 0, 0, 0.5) 0 0 10px, rgba(0,0,0,.15) 0px 1px 1px;
}
[data-button*=red]:active {
background: #600 !important;
border: 1px solid #500;
border-bottom-color: #400;
box-shadow: inset #400 0 -5px 15px, inset #e88 0 1px 1px;
}
/* Grey Theme */
[data-button*=grey] {
background: #475875 !important;
background: -moz-linear-gradient(top, #475875 0%, #36455d 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#475875), color-stop(100%,#36455d)) !important;
background: -webkit-linear-gradient(top, #475875 0%,#36455d 100%) !important;
background: -o-linear-gradient(top, #475875 0%,#36455d 100%) !important;
background: -ms-linear-gradient(top, #475875 0%,#36455d 100%) !important;
background: linear-gradient(to bottom, #475875 0%,#36455d 100%) !important;
text-shadow: #151d31 1px 1px 0;
border: 1px solid #36455d;
border-bottom-color: #151d31;
box-shadow: inset #151d31 0 -5px 15px, inset #ccf 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px;
}
[data-button*=grey]:hover,
[data-button*=grey]:focus {
background: #617699 !important;
background: -moz-linear-gradient(top, #617699 0%, #475875 100%) !important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#617699), color-stop(100%,#475875)) !important;
background: -webkit-linear-gradient(top, #617699 0%,#475875 100%) !important;
background: -o-linear-gradient(top, #617699 0%,#475875 100%) !important;
background: -ms-linear-gradient(top, #617699 0%,#475875 100%) !important;
background: linear-gradient(to bottom, #617699 0%,#475875 100%) !important;
box-shadow: inset #2d3950 0 -5px 15px, inset #ccf 0 1px 1px, rgba(0,0,0,.15) 0px 1px 1px, rgba(200,200,255,.5) 0 0 10px;
}
[data-button*=grey]:active {
background: #151d31 !important;
border: 1px solid #151d31;
border-bottom-color: #0a0f22;
box-shadow: inset #2d3950 0 -5px 15px, inset #ccf 0 1px 1px;
}
/* Outline Theme */
[data-button*=outline] {
color: inherit !important;
background: transparent !important;
text-shadow: none;
border: 1px solid currentColor;
border-bottom-color: currentColor;
box-shadow: none;
font-weight: 400;
opacity: .75 !important;
}
[data-button*=outline].disabled,
[data-button*=outline][hidden],
[data-button*=outline][disabled] {
opacity: .25 !important;
}
[data-button*=outline]:hover,
[data-button*=outline]:focus {
color: inherit !important;
background: transparent !important;
border: 1px solid currentColor;
border-bottom-color: currentColor;
box-shadow: none;
opacity: 1 !important;
}
[data-button*=outline]:active {
color: inherit !important;
background: transparent !important;
border: 1px solid currentColor;
border-bottom-color: currentColor;
box-shadow: inset rgba(0,0,0,.1) 0 0 .3em;
}
/* Semi-Flat Buttons */
[data-button*="semiflat"]:not([data-button=outline]),
[data-theme=book] [data-button]:not([data-button=outline]),
[data-theme=rfi] [data-button]:not([data-button=outline]),
[data-button*="semiflat"]:not([data-button=outline]):hover,
[data-theme=book] [data-button]:not([data-button=outline]):hover,
[data-theme=rfi] [data-button]:not([data-button=outline]):hover,
[data-button*="semiflat"]:not([data-button=outline]):focus,
[data-theme=book] [data-button]:not([data-button=outline]):focus,
[data-theme=rfi] [data-button]:not([data-button=outline]):focus {
font-weight: 600;
text-shadow: rgba(0,0,0,.2) 1px 1px 0;
box-shadow: inset rgba(255,255,255,.3) 0 1px 0;
font-family: 'Source Sans Pro', 'Open Sans', Roboto, 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Myriad Pro', 'Segoe UI', Myriad, Helvetica, 'Lucida Grande', 'DejaVu Sans Condensed', 'Liberation Sans', 'Nimbus Sans L', Tahoma, Geneva, Arial, sans-serif;
}
/* Setting up the demo */
body {
text-align: center;
min-height: 100%;
margin: 0;
padding: 50px 0;
}
Also see: Tab Triggers