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.
.container
form
.row
h4 Account
.input-group.input-group-icon
input(type="text", placeholder="Full Name")
.input-icon
i.fa.fa-user
.input-group.input-group-icon
input(type="email", placeholder="Email Adress")
.input-icon
i.fa.fa-envelope
.input-group.input-group-icon
input(type="password", placeholder="Password")
.input-icon
i.fa.fa-key
.row
.col-half
h4 Date of Birth
.input-group
.col-third
input(type="text", placeholder="DD")
.col-third
input(type="text", placeholder="MM")
.col-third
input(type="text", placeholder="YYYY")
.col-half
h4 Gender
.input-group
input(type="radio", name="gender", value="male", id="gender-male")
label(for="gender-male") Male
input(type="radio", name="gender", value="female", id="gender-female")
label(for="gender-female") Female
.row
h4 Payment Details
.input-group
input(type="radio", name="payment-method", value="card", id="payment-method-card", checked="true")
label(for="payment-method-card")
span
i.fa.fa-cc-visa
| Credit Card
input(type="radio", name="payment-method", value="paypal", id="payment-method-paypal")
label(for="payment-method-paypal")
span
i.fa.fa-cc-paypal
| Paypal
.input-group.input-group-icon
input(type="text", placeholder="Card Number")
.input-icon
i.fa.fa-credit-card
.col-half
.input-group.input-group-icon
input(type="text", placeholder="Card CVC")
.input-icon
i.fa.fa-user
.col-half
.input-group
select
option 01 Jan
option 02 Jan
select
option 2015
option 2016
.row
h4 Terms and Conditions
.input-group
input(type="checkbox", id="terms")
label(for="terms") I accept the terms and conditions for signing up to this service, and hereby confirm I have read the privacy policy.
@import "lesshat";
// MIXINS
.clearfix() {
zoom: 1;
&:before, &:after{
content: "";
display: table;
}
&:after{
clear: both;
}
}
.col() {
padding-right: 10px;
float: left;
&:last-of-type {
padding-right: 0;
}
}
.transition(@speed, @easing) {
transition: all @speed @easing;
}
// VARIABLES
@white: #fff;
@grey-lightest: #f9f9f9;
@grey-light: #e3e3e3;
@grey: #e5e5e5;
@grey-dark: #b9b9b9;
@purple: #c68eaa;
@green: #7ed321;
@emerald: #04BDBD;
@blue: #04AEC5;
@blue-dark: #0F6CC9;
@color-primary: @green;
@color-primary-strong: darken(saturate(@color-primary, 5%), 10%);
@br: 3px;
@fast: 0.35s;
@ease: ease-in-out;
// GENERAL
* {
&, &:before, &:after {
box-sizing: border-box;
}
}
body {
padding: 1em;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 15px;
// font-size: 1vw;
color: @grey-dark;
background-color: @grey-light;
}
// TYPOGRAPHY
h4 {
color: @color-primary;
}
// FORM
input {
width: 100%;
padding: 1em;
line-height: 1.4;
background-color: @grey-lightest;
border: 1px solid @grey;
border-radius: 3px;
.transition(@fast, @ease);
&:focus {
outline: 0;
border-color: @color-primary-strong;
& + .input-icon {
i {
color: @color-primary;
}
&:after {
border-right-color: @color-primary;
}
}
}
&[type="radio"] {
display: none;
& + label {
&:extend(input);
display: inline-block;
width: 50%;
text-align: center;
float: left;
border-radius: 0;
&:first-of-type {
border-top-left-radius: @br;
border-bottom-left-radius: @br;
}
&:last-of-type {
border-top-right-radius: @br;
border-bottom-right-radius: @br;
}
i {
padding-right: 0.4em;
}
}
&:checked + label {
background-color: @color-primary;
color: @white;
border-color: @color-primary-strong;
}
}
&[type="checkbox"] {
display: none;
& + label {
position: relative;
display: block;
padding-left: 1.6em;
&:before {
&:extend(input);
position: absolute;
top: 0.2em;
left: 0;
display: block;
width: 1em;
height: 1em;
padding: 0;
content: "";
}
&:after {
position: absolute;
top: 0.45em;
left: 0.2em;
font-size: 0.8em;
color: @white;
opacity: 0;
font-family: FontAwesome;
content: "\f00c";
}
}
}
&:checked + label {
&:before {
&:extend(input[type="radio"]:checked + label);
}
&:after {
opacity: 1;
}
}
}
select {
&:extend(input[type="radio"] + label);
height: 3.4em;
line-height: 2;
&:first-of-type {
border-top-left-radius: @br;
border-bottom-left-radius: @br;
}
&:last-of-type {
border-top-right-radius: @br;
border-bottom-right-radius: @br;
}
&:focus, &:active {
outline: 0;
&:extend(input[type="radio"]:checked + label);
}
option {
&:extend(input);
background-color: @color-primary;
color: @white;
}
}
.input-group {
margin-bottom: 1em;
.clearfix();
}
.input-group-icon {
position: relative;
input {
padding-left: 4.4em;
}
.input-icon {
position: absolute;
top: 0;
left: 0;
width: 3.4em;
height: 3.4em;
line-height: 3.4em;
text-align: center;
pointer-events: none;
&:after {
position: absolute;
top: 0.6em;
bottom: 0.6em;
left: 3.4em;
display: block;
border-right: 1px solid @grey;
content: "";
.transition(@fast, @ease);
}
i {
.transition(@fast, @ease);
}
}
}
// STRUCTURE
.container {
max-width: 38em;
padding: 1em 3em 2em 3em;
margin: 0em auto;
background-color: @white;
border-radius: @br * 1.4;
box-shadow: 0px 3px 10px -2px rgba(0,0,0,0.2);
}
.row {
.clearfix();
}
.col-half {
.col();
width: 100% / 2;
}
.col-third {
.col();
width: 100% / 3;
}
@media only screen and (max-width: 540px) {
.col-half {
width: 100%;
padding-right: 0;
}
}
// INSPIRED BY SEB KAY'S 'SIGN UP FORM'
// https://dribbble.com/shots/1776663-Purple-Sign-Up-Form
// https://dribbble.com/shots/1779149--Free-PSD-Purple-Sign-Up-Form-Payment-Details
// DO YOU HAVE A SPARE DRIBBBLE INVITE? I'D APPRECIATE IT!
// dribbble.com/josec
Also see: Tab Triggers