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.
<h1>Lorem Ipsum</h1>
<h2>Lorem Ipsum</h2>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam gravida
risus quis metus ornare, id rhoncus sapien placerat. Vivamus vel
ultrices arcu. Suspendisse potenti. Cras consequat, justo at venenatis
euismod, sapien metus luctus ligula, vel faucibus nisi purus vel augue.
Sed ut ante eu nulla eleifend ultrices ut sit amet lacus. Sed porta
malesuada tristique. Cras id lectus at est fermentum sollicitudin.
Maecenas at diam mi. Curabitur non massa rhoncus, pretium odio quis,
facilisis odio. Suspendisse iaculis id neque at congue. Phasellus luctus
felis non nisi tincidunt, ut mollis dolor ultrices. Curabitur placerat
lorem sed enim aliquet, sit amet luctus massa blandit. Aenean nunc
nulla, lobortis at euismod vel, imperdiet at ex. Mauris interdum
molestie eros, et laoreet dui tincidunt ut. Proin libero lectus,
suscipit ut leo nec, tincidunt volutpat sapien. Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia curae;
</p>
<div>
<div data-widget="webform">
<script type="text/props">
{
"multistep": true,
"attributes": {
"className": "survey"
},
"open": {
"text": "Register for the event in 60 seconds",
"attributes": {
"className": "btn btn-primary"
}
},
"splash": {
"eyebrow": "Join the Solar Revolution",
"headline": "Shine a light on your solar experience in just 60 seconds",
"subline": "Help Us Brighten Your Solar Journey: Take Our Quick Survey Toda",
"body": "Your insights are a beacon for us! If you're a customer who's gone solar, we want to hear from you. Spare just 60 seconds of your time to complete our survey. Help us make the solar transition smoother for everyone",
"button": {
"text": "Show me the survey!",
"attributes": {
"className": "btn btn-primary"
}
},
"attributes": {
"className": "btn btn-primary"
}
},
"form": {
"action": "https://hooks.zapier.com/hooks/catch/000000/ABCD12345/",
"method": "POST",
"backButton": {
"text": "‹",
"attributes": {
"style": {
"textDecoration": "none",
"color": "#999",
"fontWeight": "bold",
"fontSize": "1.4rem"
}
}
},
"nextButton": {
"text": "Go",
"attributes": {
"className": "btn btn-primary"
}
},
"submitButton": {
"text": "Send me quotes",
"attributes": {
"className": "btn btn-primary"
}
},
"fields": [
{
"name": "referral",
"label": "How did you hear about us?",
"type": "select",
"containerAttributes":{
"className": "form-group"
},
"attributes": {
"className": "form-control",
"required": true,
"ariaLabel": "How did you hear about us?"
},
"options": [
{
"value": "search",
"label": "Search"
},
{
"value": "friend",
"label": "A Friend"
},
{
"value": "other",
"label": "Somewhere else"
}
]
},
{
"name": "topics",
"label": "What topics are you interested in?",
"type": "checkbox",
"containerAttributes":{
"className": "form-group"
},
"labelAttributes":{
"className": "form-check-label"
},
"attributes": {
"required": true,
"ariaLabel": "What are you interested in",
"className": "form-check"
},
"options": [
{
"value": "art",
"label": "Art"
},
{
"value": "science",
"label": "Science"
},
{
"value": "technology",
"label": "Technology"
}
]
},
{
"name": "firstname",
"label": "What is your first name?",
"type": "text",
"containerAttributes":{
"className": "form-group row"
},
"attributes": {
"className": "form-control",
"required": true,
"placeholder": "Enter your name",
"ariaLabel": "Enter your name"
}
},
{
"name": "lastname",
"label": "What is your last name?",
"type": "text",
"containerAttributes":{
"className": "form-group"
},
"attributes": {
"className": "form-control",
"required": true,
"placeholder": "Enter your family name",
"ariaLabel": "Enter your family name"
}
},
{
"name": "phone",
"label": "What's your phone number",
"description": "In case we need to get a hold of you, how can we reach you?",
"type": "tel",
"attributes": {
"className": "form-control",
"required": true,
"placeholder": "000-000-0000",
"ariaLabel": "Enter your phone",
"pattern": "[0-9]{3}[0-9]{3}[0-9]{4}"
}
},
{
"name": "email",
"label": "What's your email address?",
"description": "We promise not to spam you.",
"type": "email",
"attributes": {
"className": "form-control",
"required": true,
"placeholder": "Enter your address",
"ariaLabel": "Enter your address"
}
},
{
"name": "notes",
"label": "Tell us notes",
"type": "textarea",
"containerAttributes":{
"className": "form-group"
},
"attributes": {
"className": "form-control",
"required": true,
"placeholder": "Describe notes",
"ariaLabel": "Enter your notes"
}
},
{
"name": "company_size",
"label": "How big is your company?",
"type": "select",
"containerAttributes":{
"className": "form-group"
},
"attributes": {
"className": "form-control",
"required": true,
"placeholder": "Select your company size"
},
"options": [
{
"value": "1-10",
"label": "1 to 10"
},
{
"value": "11-20",
"label": "11 to 20"
},
{
"value": "21-30",
"label": "21 to 30"
}
]
},
{
"name": "i_agree",
"label": "Terms & Conditions",
"type": "checkbox",
"attributes": {
"required": true
},
"options": [
{
"value": "yes",
"label": "I agree to the terms and conditions"
}
]
}
]
}
}
</script>
</div>
</div>
<p>
Nunc tempus lobortis rhoncus. Vestibulum ante ipsum primis in faucibus
orci luctus et ultrices posuere cubilia curae; Vivamus tristique
convallis dui a pretium. Proin ultricies porttitor est nec sagittis.
Nulla sit amet porta neque. Aliquam erat volutpat. Praesent mattis odio
augue, id ornare velit placerat et. Cras facilisis metus eu euismod
pharetra. Mauris lectus magna, aliquet sed nulla ac, suscipit luctus mi.
Suspendisse viverra vehicula dolor vitae feugiat. Mauris ac nisl
commodo, commodo justo mattis, porta massa. In quis augue sagittis,
pharetra risus at, iaculis purus. Aliquam nec odio purus. Duis pulvinar
eu magna sed fringilla. Donec auctor ante felis, ac semper libero
consectetur tincidunt. Nunc efficitur nisi id pretium accumsan.
</p>
<p>
Vivamus finibus massa a libero tempor auctor. Proin hendrerit, nisi eget
efficitur viverra, dui ligula imperdiet nibh, vulputate vulputate ipsum
eros a neque. Sed vitae massa vehicula, commodo magna vel, ullamcorper
nulla. In eget ante porttitor, tincidunt est et, ullamcorper odio.
Maecenas id dignissim sem. Praesent justo ligula, congue a elit non,
tincidunt aliquam felis. Sed eu dui purus. Cras molestie semper commodo.
</p>
<p>
Aenean elit purus, tincidunt pellentesque ipsum vel, ultricies iaculis
metus. Fusce fringilla erat sit amet diam finibus, tempus eleifend
tellus sollicitudin. In ut elit eget libero tempor aliquam quis et
nulla. Pellentesque sit amet libero hendrerit, elementum risus nec,
vulputate nulla. Nam mattis tortor ac ex porttitor sollicitudin. Etiam
ultrices semper lacus, a blandit quam egestas a. Pellentesque sed augue
quis diam tincidunt posuere. Suspendisse gravida vel magna ac pharetra.
</p>
<p>
Suspendisse orci purus, egestas eget pharetra a, pretium eu libero.
Mauris arcu libero, euismod quis accumsan in, vehicula in lacus.
Praesent dapibus finibus turpis, ac pellentesque nunc tristique vitae.
Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Morbi scelerisque ex sem, vel sodales magna
sagittis lacinia. Cras gravida arcu ac elit sodales, non porttitor urna
euismod. Ut libero mi, mattis eu congue vitae, posuere vel lacus. Donec
ac ligula sit amet ipsum suscipit placerat non at elit. Quisque in
gravida nunc. Integer hendrerit nibh non felis commodo, faucibus dapibus
justo pretium. Fusce et sodales est. Duis posuere ante a viverra
laoreet. Nulla finibus justo tellus, nec porttitor tortor tempus ut.
Duis hendrerit scelerisque turpis ac accumsan. Nullam vehicula ut ante
vel sodales. In hac habitasse platea dictumst.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam gravida
risus quis metus ornare, id rhoncus sapien placerat. Vivamus vel
ultrices arcu. Suspendisse potenti. Cras consequat, justo at venenatis
euismod, sapien metus luctus ligula, vel faucibus nisi purus vel augue.
Sed ut ante eu nulla eleifend ultrices ut sit amet lacus. Sed porta
malesuada tristique. Cras id lectus at est fermentum sollicitudin.
Maecenas at diam mi. Curabitur non massa rhoncus, pretium odio quis,
facilisis odio. Suspendisse iaculis id neque at congue. Phasellus luctus
felis non nisi tincidunt, ut mollis dolor ultrices. Curabitur placerat
lorem sed enim aliquet, sit amet luctus massa blandit. Aenean nunc
nulla, lobortis at euismod vel, imperdiet at ex. Mauris interdum
molestie eros, et laoreet dui tincidunt ut. Proin libero lectus,
suscipit ut leo nec, tincidunt volutpat sapien. Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia curae;
</p>
<p>
Nunc tempus lobortis rhoncus. Vestibulum ante ipsum primis in faucibus
orci luctus et ultrices posuere cubilia curae; Vivamus tristique
convallis dui a pretium. Proin ultricies porttitor est nec sagittis.
Nulla sit amet porta neque. Aliquam erat volutpat. Praesent mattis odio
augue, id ornare velit placerat et. Cras facilisis metus eu euismod
pharetra. Mauris lectus magna, aliquet sed nulla ac, suscipit luctus mi.
Suspendisse viverra vehicula dolor vitae feugiat. Mauris ac nisl
commodo, commodo justo mattis, porta massa. In quis augue sagittis,
pharetra risus at, iaculis purus. Aliquam nec odio purus. Duis pulvinar
eu magna sed fringilla. Donec auctor ante felis, ac semper libero
consectetur tincidunt. Nunc efficitur nisi id pretium accumsan.
</p>
<p>
Suspendisse orci purus, egestas eget pharetra a, pretium eu libero.
Mauris arcu libero, euismod quis accumsan in, vehicula in lacus.
Praesent dapibus finibus turpis, ac pellentesque nunc tristique vitae.
Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Morbi scelerisque ex sem, vel sodales magna
sagittis lacinia. Cras gravida arcu ac elit sodales, non porttitor urna
euismod. Ut libero mi, mattis eu congue vitae, posuere vel lacus. Donec
ac ligula sit amet ipsum suscipit placerat non at elit. Quisque in
gravida nunc. Integer hendrerit nibh non felis commodo, faucibus dapibus
justo pretium. Fusce et sodales est. Duis posuere ante a viverra
laoreet. Nulla finibus justo tellus, nec porttitor tortor tempus ut.
Duis hendrerit scelerisque turpis ac accumsan. Nullam vehicula ut ante
vel sodales. In hac habitasse platea dictumst.
</p>
</div>
<script type="module" crossorigin src="https://cdn.kennedy.jp/fantastic-engine/v1.0.0.js"></script>
body {
padding: 15px 10px;
}
form {
label: table;
}
div.form-example {
label: table-row;
}
label,
input {
label: table-cell;
margin-bottom: 10px;
}
label {
padding-right: 10px;
}
.focus {
border-color: darkblue;
}
.dirty {
border-color: darkblue;
}
.error {
border: 2px solid red;
}
.valid {
border: 1px solid green;
}
.survey .lightbox-body {
padding: 15px 20px;
width: 60%;
}
@media only screen and (max-width: 768px) {
.survey .lightbox-body {
width: 100%;
}
}
Also see: Tab Triggers