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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<h1 id="title">Motorcyclist's Survey</h1>
<div id="container">
<p id="description">A Personal Protection Questionaire</p>
<form id="survey-form" action="#" method="GET">
<div id="personal-info">
<div class="name">
<label for="name" id="name-label">Name <b>*</b></label>
<input class="input-area" id="name" type="text" placeholder="Joe Rider" required>
</div>
<div class="email">
<label for="email" id="email-label">Email <b>*</b></label>
<input class="input-area" id="email" type="email" placeholder="Your Email" required>
</div>
<div class="age">
<label for="number" id="number-label">Age</label>
<input class="input-area" id="number" type="number" placeholder="Age" min="18" max="99">
</div>
</div>
<p>How many years have you been riding?
<select class="dropdown" name="years-ride">
<option value=" " selected>--Please select one--</option>
<option value="under one">0 - 11 months</option>
<option value="1-5">1 - 5 years</option>
<option value="6-10">6 - 10 years</option>
<option value="11-15">7 - 15 years</option>
<option value="16-20">16 - 20 years</option>
<option value="21-25">21 - 25 years</option>
<option value="25-30">26 - 30 years</option>
<option value=">30">over 30 years</option>
</select></p>
<p>What type of riding do you do?
<select class="dropdown" id="dropdown" name="rider-type">
<option value="commuter">Commuter</option>
<option value="weekendRider">Weekend rider</option>
<option value="adventureTouring" selected>Adventure/Touring</option>
<option value="offRoad">Off-road</option>
<option value="other">Other</option>
</select></p>
<div class="gear-section">
<fieldset class="fieldset">
<legend>Do you wear protective gear?</legend>
<label class="radiob" for="yes">
<input id="yes" type="radio" name="safety-gear" value="yes">Yes
</label>
<label class="radiob" for="sometimes">
<input id="sometimes" type="radio" name="safety-gear" value="sometimes">Sometimes
</label>
<label class="radiob" for="no">
<input id="no" type="radio" name="safety-gear" value="no">No
</label>
</fieldset>
<div class="gear-worn">
<fieldset class="fieldset">
<legend>What protective gear do you wear? (Choose all that apply)</legend>
<label class="cbox" for="helmet">
<input id="helmet" type="checkbox" class="protective-gear" value="helmet">Helmet
</label>
<label class="cbox" for="eye-protection">
<input id="eye-protection" type="checkbox" class="protective-gear" value="eye">Eye protection
</label>
<label class="cbox" for="gloves">
<input id="gloves" type="checkbox" class="protective-gear" value="gloves">Gloves
</label>
<label class="cbox" for="long-pants">
<input id="long-pants" type="checkbox" class="protective-gear" value="pants">Long pants
</label>
<label class="cbox" for="jacket">
<input id="jacket" type="checkbox" class="protective-gear" value="jacket">Jacket
</label>
<label class="cbox" for="body-armor">
<input id="body-armor" type="checkbox" class="protective-gear" value="armor">Body Armor
</label>
<label class="cbox" for="riding-boots">
<input id="riding-boots" type="checkbox" class="protective-gear" value="boots">Riding Boots
</label>
<label class="cbox" for="reflective">
<input id="reflective" type="checkbox" class="protective-gear" value="reflective">Reflective vest
</label>
<label class="cbox" for="none">
<input id="none" type="checkbox" class="protective-gear" value="none">Don't wear protective gear
</label>
</fieldset>
</div>
<div class="importance">
<p>Score each of the following based on your decision when choosing protective gear</p>
<div class="col-25" id="style">Style</div>
<select class="dropdown col-75" id="style-score">
<option value="">--Please select one--</option>
<option value="1">1 - Not important</option>
<option value="2">2 - A little</option>
<option value="3">3 - Doesn't impact my decision</option>
<option value="4">4 - Important</option>
<option value="5">5 - Very important</option>
</select>
<div style="clear:both"></div>
<div class="col-25" id="Comfort">Comfort</div>
<select class="dropdown col-75" id="comfort-score">
<option value="">--Please select one--</option>
<option value="1">1 - Not important</option>
<option value="2">2 - A little</option>
<option value="3">3 - Doesn't impact my decision</option>
<option value="4">4 - Important</option>
<option value="5">5 - Very important</option>
</select>
<div style="clear:both"></div>
<div class="col-25" id="Price">Price</div>
<select class="dropdown col-75" id="price-score">
<option value="">--Please select one--</option>
<option value="1">1 - Not important</option>
<option value="2">2 - A little</option>
<option value="3">3 - Doesn't impact my decision</option>
<option value="4">4 - Important</option>
<option value="5">5 - Very important</option>
</select>
<div style="clear:both"></div>
<div class="col-25" id="Protection">Protection</div>
<select class="dropdown col-75" id="protection-score">
<option value="">--Please select one--</option>
<option value="1">1 - Not important</option>
<option value="2">2 - A little</option>
<option value="3">3 - Doesn't impact my decision</option>
<option value="4">4 - Important</option>
<option value="5">5 - Very important</option>
</select>
<div style="clear:both"></div>
<div class="col-25" id="Visibility">Visibility</div>
<select class="dropdown col-75" id="visibility-score">
<option value="">--Please select one--</option>
<option value="1">1 - Not important</option>
<option value="2">2 - A little</option>
<option value="3">3 - Doesn't impact my decision</option>
<option value="4">4 - Important</option>
<option value="5">5 - Very important</option>
</select>
<div style="clear:both"></div>
</div>
</div>
<div class="mods">
<fieldset class="fieldset">
<legend>Have you made modifications to your motorcycle to make it more visible?</legend>
<label class="radiob" for="yay">
<input id="yay" type="radio" name="modifications" value="yes">Yes
</label>
<label class="radiob" for="nay">
<input id="nay" type="radio" name="modifications" value="no">No
</label>
</fieldset>
<div class="modifications">
<fieldset class="fieldset">
<legend>What modifications have you made? (Chose all that apply)</legend>
<label class="cbox" for="headlight">
<input id="headlight" type="checkbox" class="modified" value="headlight">Headlight modulator
</label>
<label class="cbox" for="led">
<input id="led" type="checkbox" class="modified" value="led">LED Headlight/Taillights
</label>
<label class="cbox" for="reflect">
<input id="reflect" type="checkbox" class="modified" value="reflective">Reflective stickers or Tape
</label>
<label class="cbox" for="brake">
<input id="brake" type="checkbox" class="modified" value="brake">Modulating brake lights
</label>
<label class="cbox" for="other">
<input id="other" type="checkbox" class="modified" value="other">Flags or Pennants
</label>
</fieldset>
</div>
</div>
<p class="comments">Comments</p>
<textarea id="comments" rows="8" cols="50" placeholder="Additional comments"></textarea>
<button id="submit" type="submit">Submit</button>
</form>
</div>
body {
border: 0px;
margin: 0px;
padding: 0px;
box-sizing: border-box;
background-image: url(https://raw.githubusercontent.com/sjrom-a/fccWebDesignProjects/master/surveyForm/images/deluxe.jpg);
background-size: cover;
font-family: 'Rubik', sans-serif;
text-align: center;
}
#container {
background: rgba(249, 249, 249, 0.8);
border-radius: 4px;
margin: 0px auto 10px auto;
max-width: 80%;
padding: 20px;
}
.gear-section,
.mods {
background: rgba(0,0,0,0.03);
border-radius: 4px;
margin-bottom: 5px;
padding: 10px;
}
.radiob:hover, .cbox:hover {
background-color: #333;
border-radius: 4px;
color: #ccc;
}
fieldset {
line-height: 1.5;
}
select {
background-color: white;
}
#description {
font-size: larger;
font-weight: 500;
}
input:required {
background-color: lightyellow;
}
.name,
.email,
.age {
padding-bottom: 5px;
}
input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
border-radius: 4px;
border: 1px solid #ccc;
transition: box-shadow .3s;
outline: none;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
box-shadow: 0 1px 10px #999;
}
#number-label {
padding-right: 20px;
}
b {
color: red;
}
.input-area {
font-size: small;
height: 25px;
padding-left: 10px;
width: 280px;
}
.dropdown {
font-size: small;
height: 35px;
width: 160px;
}
.gear-worn,
.modifications {
margin: 0 auto;
max-width: 75%;
min-width: 95%;
padding-top: 30px;
}
.fieldset {
border-radius: 4px;
display: inline-grid;
text-align: left;
}
.protective-gear,
.modified {
margin-left: 15px;
margin-right: 10px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.col-25 {
float: left;
width: 25%;
margin-top: 12px;
padding-right: 6px;
text-align: right;
}
.col-75 {
float: left;
width: 50%;
margin-top: 6px;
}
/* Clear floats after the columns */
.importance:after {
content: "";
display: table;
clear: both;
}
.comments {
margin-bottom: unset;
text-align: left;
}
textarea {
background-color: #f9f9f9;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: small;
height: 150px;
padding: 10px 15px;
resize: none;
width: 100%;
}
button {
background-color: #59ace0;
border-radius: 4px;
color: white;
cursor: pointer;
font-size: 15px;
height: 40px;
width: 80px;
transition: background-color .5s;
border: none;
box-shadow: 0 1px 10px #999;
}
button:hover {
background-color: #1d6fa3;
}
// coded by sjroma
const projectName = 'survey-form';
localStorage.setItem('example_project', 'Survey Form');
Also see: Tab Triggers