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.
<h1 id="title">Survey Form</h1>
<div id="form-outer">
<p id="description">
Let Ninjacat know how it can improve its skills
</p>
<form id="survey-form" method="GET" action="https://crossorigin.me/https://freecodecamp.com">
<div class="rowTab">
<div class="labels">
<label id="name-label" for="name">Name: </label>
</div>
<div class="rightTab">
<input autofocus type="text" name="name" id="name" class="input-field" placeholder="your name" required>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label id="email-label" for="email">E-mail: </label>
</div>
<div class="rightTab">
<input type="email" name="email" id="email" class="input-field" required placeholder="your e-mail">
</div>
</div>
<div class="rowTab">
<div class="labels">
<label id="number-label" for="age">Age: </label>
</div>
<div class="rightTab">
<input type="number" name="age" id="number" min="1" max="125" class="input-field" placeholder="age">
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="currentPos">Which option best describes your current role?</label>
</div>
<div class="rightTab">
<select id="dropdown" name="currentPos" class="dropdown">
<option disabled value>Select an option</option>
<option value="learner">Padawan</option>
<option value="preferNo">Jedi</option>
<option value="preferNo">Sith Lord</option>
<option value="preferNo">Sensei</option>
<option value="preferNo">Sellsword</option>
<option value="preferNo">Elite Tauren Chieftain</option>
<option value="other">Other</option>
</select>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="userRating">How likely is it that Ninjacat would defeat Chuck Norris in a duel to the death?</label>
</div>
<div class="rightTab">
<ul style="list-style: none;">
<li class="radio"><label>Definitely<input name="radio-buttons" value="1" type="radio" class="userRatings" ></label></li>
<li class="radio"><label>Maybe<input name="radio-buttons" value="2" type="radio" class="userRatings" ></label></li>
<li class="radio"><label>Not sure<input name="radio-buttons" value="3" type="radio" class="userRatings" ></label></li>
</ul>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="most-like">What do you like most about Ninjacat: </label>
</div>
<div class="rightTab">
<select id="most-like" name="mostLike" class="dropdown">
<option disabled selected value>Select an option</option>
<option value="challenges">One-lick-knockout</option>
<option value="projects">Death-purr</option>
<option value="community">Petrifying Gaze of the Black Lotus</option>
<option value="openSource">Hunger of the Thousand Claws</option>
</select>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="preferences">Things that Ninjacat must improve in order to stay on top of its game:<br>(Check all that apply): </label>
</div>
<div class="rightTab">
<ul id="preferences" style="list-style: none;">
<li class="checkbox"><label><input name="prefer" value="1" type="checkbox" class="userRatings">One-paw pushups</label></li>
<li class="checkbox"><input name="prefer" value="2" type="checkbox" class="userRatings">Mountain hopping by night</li>
<li class="checkbox"><label><input name="prefer" value="3" type="checkbox" class="userRatings">Cybernetic prosthetics</label></li>
<li class="checkbox"><label><input name="prefer" value="4" type="checkbox" class="userRatings">Nanowarfare research</label></li>
<li class="checkbox"><label><input name="prefer" value="5" type="checkbox" class="userRatings">Morning milk scrying</label></li>
<li class="checkbox"><label><input name="prefer" value="6" type="checkbox" class="userRatings">Chasing hulk-rats while blindfolded</label></li>
<li class="checkbox"><label><input name="prefer" value="7" type="checkbox" class="userRatings">Sofa-scratching routine</label></li>
<li class="checkbox"><label><input name="prefer" value="8" type="checkbox" class="userRatings">Mastering the Th'um of M'Eow</label></li>
<li class="checkbox"><label><input name="prefer" value="9" type="checkbox" class="userRatings">Elor bindel felallan morin'aminor</label></li>
<li class="checkbox"><label><input name="prefer" value="10" type="checkbox" class="userRatings">One cannot improve what has been made perfect already</label></li>
</ul>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="comments">Any comments or suggestions?</label>
</div>
<div class="rightTab">
<textarea id="comments" class="input-field" style="height:50px;resize:vertical;" name="comment" placeholder="Enter your comment here..."></textarea>
</div>
</div>
<button id="submit" type="submit">Submit</button>
</form>
</div>
@import url(https://fonts.googleapis.com/css?family=Raleway:400,500);
html,
body {
background-color: #88A5BD;
color: #002626;
text-align: center;
font-family: "Raleway", Helvetica, sans-serif;
min-width: 320px;
}
header {
font-size: 2em;
font-weight: bold;
margin: 20px;
}
#title {
color: #FC4949;
background-color: #F7CB5C;
margin: 0 auto;
border-radius: 4px;
width: 75%;
max-width: 900px;
padding: 10px;
padding-top: 20px;
font-size: 3em;
font-weight: bold;
}
#description {
color: #002626;
font-weight: bold;
}
#form-outer {
background-color: #FFF4E0;
margin: 5px auto;
border-radius: 4px;
width: 75%;
max-width: 900px;
padding: 10px;
padding-top: 20px;
}
.labels {
display: inline-block;
text-align: right;
width: 40%;
padding: 5px;
vertical-align: top;
margin-top: 10px;
}
.rightTab {
display: inline-block;
text-align: left;
width: 48%;
vertical-align: middle;
}
.input-field {
height: 20px;
width: 280px;
padding: 5px;
margin: 10px;
border: 2px solid #88A5BD;
border-radius: 5px;
}
#userAge {
width: 40px;
}
.userRatings,
input[type="checkbox"] {
float: left;
margin-right: 5px;
}
#submit {
background-color: #00ADB5;
border-radius: 4px;
color: white;
font-size: 1em;
height: 40px;
width: 96px;
margin: 10px;
border: 0px solid;
}
.dropdown {
background-color: #fff;
height: 35px;
width: 140px;
padding: 5px;
margin: 10px;
margin-top: 15px;
border: 2px solid #88A5BD;
border-radius: 5px;
}
.radio,
.checkbox {
position: relative;
left: -43px;
margin-left: 10px;
display: block;
padding-bottom: 10px;
}
@media screen and (max-width: 833px) {
.input-field {
width: 80%;
}
select {
width: 90%;
}
}
@media screen and (max-width: 520px) {
.labels {
width: 100%;
text-align: left;
}
.rightTab {
width: 80%;
float: left;
}
.input-field {
width: 100%;
}
select {
width: 100%;
}
}
// coded by @SamAI-Software
const projectName = 'survey-form';
localStorage.setItem('example_project', 'Survey Form');
Also see: Tab Triggers