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.
<form>
<p>Just a fun experiment. Resize browser for responsexy.</p>
<fieldset>
<legend>Subscription type</legend>
<input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" />
<label for="radio-choice-1">
Basic
<span>You get basic stuff for this one</span>
<strong>$5/mo</strong>
</label>
<input type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2" />
<label for="radio-choice-2">
Extended
<span>This is already a lot more</span>
<strong>$10/mo</strong>
</label>
</fieldset>
<fieldset>
<legend>Amount of awesome</legend>
<input type="radio" name="radio-choice-2" id="radio-choice-3" value="choice-3" />
<label for="radio-choice-3">
Modest user
<span>Affordable and functional</span>
<strong>100</strong>
</label>
<input type="radio" name="radio-choice-2" id="radio-choice-4" value="choice-4" />
<label for="radio-choice-4">
Average user
<span>Just a right amount of normal</span>
<strong>200</strong>
</label>
<input type="radio" name="radio-choice-2" id="radio-choice-5" value="choice-5" checked />
<label for="radio-choice-5" class="most-chosen">
Active user
<span>For active peeps</span>
<strong>400</strong>
</label>
<input type="radio" name="radio-choice-2" id="radio-choice-6" value="choice-6" />
<label for="radio-choice-6">
Power user
<span>Pretty rad this one</span>
<strong>800</strong>
</label>
<input type="radio" name="radio-choice-2" id="radio-choice-7" value="choice-7" />
<label for="radio-choice-7">
Extreme user
<span>You get ALL the awesome stuff</span>
<strong>1.000</strong>
</label>
</fieldset>
<button>Submit</button>
</form>
<p class="footer">Design totally based on <a href="https://www.ben.nl/sim-only?looptijd=1&bellen=regelmatig&internet=regelmatig">ben.nl/sim-only</a></p>
@import "//fonts.googleapis.com/css?family=Roboto+Condensed:400,700&subset=latin"
$blue: #00aeef
$lightgray: #ddd
*,
*:before,
*:after
box-model: border-box
body
color: #333
font: 20px/1.5 'Roboto Condensed', sans-serif
background: #eee
min-width: 420px
form,
fieldset,
legend
padding: 0
margin: 0
form
width: 50%
margin: 50px auto
overflow: hidden
fieldset
margin: 60px 0
position: relative
border: 1px solid $lightgray
legend
font-weight: 600
position: absolute
top: -40px
border: 0
input[type=radio]
display: none
label
font-size: 17px
font-weight: bold
line-height: 1
cursor: pointer
display: block
padding: 15px 10px 15px 50px
position: relative
border-top: 1px solid $lightgray
background: white
whitespace: no-wrap
overflow: hidden
text-overflow: ellipsis
transition: all .15s ease
&:focus,
&:hover,
&:active
@extend %active-label
&:first-of-type
border: 0
&:before
content: ""
position: absolute
left: 14px
top: 14px
width: 16px
height: 16px
border-radius: 50%
border: 1px solid darken($lightgray, 5%)
span
color: darken($lightgray, 15%)
font-weight: normal
position: absolute
left: 35%
strong
color: $blue
text-align: right
float: right
input:checked + label
@extend %active-label
%active-label
color: white
background: $blue
border-color: white
span,
strong
color: white
&:before
left: 13px
top: 13px
width: 12px
height: 12px
border: 4px solid white
background: $blue
.most-chosen
&:after
content: "MOST CHOSEN"
color: white
font-size: 12px
font-weight: normal
background: #333
position: absolute
right: 12%
top: 13px
display: block
padding: 5px 7px
button
color: white
background: $blue
border: 0
padding: 10px 15px
float: right
&:focus,
&:hover,
&:active
background: #333
outline: 0
p
color: #666
a
color: $blue
.footer
text-align: center
@media all and (max-width: 1000px)
.most-chosen:after
content: none
@media all and (max-width: 800px)
label
padding-bottom: 35px
&:before
top: 25px
span
font-size: 14px
display: block
margin-top: 5px
left: auto
input:checked + label,
label:focus,
label:active,
label:hover
&:before
top: 24px
button
width: 100%
float: none
@media all and (max-width: 550px)
label
padding: 15px 10px 15px 50px
&:before
left: 14px
top: 14px
span
display: none
input:checked + label,
label:focus,
label:active,
label:hover
&:before
left: 13px
top: 13px
Also see: Tab Triggers