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.
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!-- head - Googlefonts link -->
<div id="outside">
<form id="survey-form" action="/my-handling-form-page" method="post">
<h1 id="title">Application for permission to date my daughter</h1>
<p id="description"><b>Note:</b> Form is to be completed at least 21 days prior to date</p>
<!-- ------------------Personal Details---------------------------- -->
<fieldset>
<!-- groups of widgets that share the same purpose, for styling and semantic purposes -->
<legend>Personal Details</legend>
<!-- formally describes the purpose of the fieldset it is included inside. -->
<div>
<label id="name-label" for="name">Name:</label>
<input type="text" required id="name" name="user_name" placeholder="Enter name here"> </div>
<div>
<label for="address-label">Address:</label>
<input type="Address" id="address" name="Address" placeholder="Enter address here"> </div>
<div>
<label id="email-label" for="Email">Email:</label>
<input type="email" required id="email" name="user_email" placeholder="Enter email here"> </div>
<div>
<label id="number-label" for="phone">Phone Number:</label>
<input type="number" id="number" name="user_name" placeholder="Enter 10 digit number" min="1" max="9"> </div>
<div>
<label id="iq-label" for="iq">IQ:</label>
<input type="number" id="iq" name="iq" placeholder="Enter IQ here"> </div>
<!-- ------------------Radio Buttons-------------------------------- -->
<div>
<label for="Gender">Gender</label>
<p>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</p>
</div>
<label for="date-label">Date of Proposed Outing:</label>
<input type="date" name="bday">
</fieldset>
<!-- ------------------Checkboxes-------------------------------- -->
<fieldset>
<label for="Gender">Check All That Apply</label>
<p>
<input type="checkbox" name="tattoo" value="tattoo"> I have tattoos and/or piercings<br>
<input type="checkbox" name="age" value="Car"> I am more than 2 years older than my daughter<br>
<input type="checkbox" name="car" value="car"> I own a panel van or V8 ute<br>
<input type="checkbox" name="work" value="work" checked> I work full-time<br>
<input type="checkbox" name="rich" value="rich" checked> My parents are rich<br>
<input type="checkbox" name="loc" value="loc" checked> Is the date at a well lit public location<br>
</p>
</fieldset>
<!-- -----------------Dropdown menus--------------------------------- -->
<fieldset>
<div>
<label for="politics">Political Persuasion:</label>
<select id="dropdown">
<option value="left">Left Wing</option>
<option value="right">Right Wing</option>
<option value="conservative">Conservative</option>
<option value="nazi">Nazi</option>
</select>
<label for="politics">Education Level Completed:</label>
<select id="dropdown2">
<option value="University">University</option>
<option value="College">College</option>
<option value="Secondary">High School</option>
<option value="None">None</option>
</select>
</div>
</fieldset>
<!-- --------------------Text Areas------------------------------ -->
<fieldset>
<legend>Essay Section</legend>
<div>
<label for="msg"></label>
<p> In 50 words or more explain why you want to date my daughter</p>
<textarea id="msg" name="user_message" rows="4" cols="50" placeholder="Enter Text Here"></textarea> </div>
<div>
<label for="msg">Please upload contact details for 2 references</label><br>
<textarea id="msg2" name="user_message" rows="4" cols="50" placeholder="Enter Text Here"></textarea> </div>
<p>Upload Police Clearance Certificate, Bank Statement and Medical Certifiates here:
<button>Attach Files</button></p>
</fieldset>
<div id="submitbutton">
<button type="submit" id="submit">Send your application</button> </div>
</form>
</div>
<!-- https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation -->
body {
font-family: 'Anaheim';
font-size: 1.2em;
}
#outside {
background-color: lightgoldenrodyellow;
padding-top: 25px;
padding-bottom: 25px;
}
h1 {
font-size: 1.5em;
text-align: center;
text-transform: capitalize;
}
form {
/* Just to center the form on the page */
margin: 0 auto;
width: 70%;
/* To see the limits of the form */
padding: 1em;
border: 1px solid #CCC;
border-radius: 1em;
}
#survey-form {
background-color: white;
}
fieldset {
border:1px solid lightgray;
margin: 10px;
}
legend {
font-weight: 700;
}
#number {
width: 150px;
}
div + div {
margin-top: 1em;
}
/* label {
/* To make sure that all label have the same size and are properly align */
/* display: inline-block; */
/* width: 80px; */
/* text-align: right; */
} */
input, textarea {
/* To make sure that all text field have the same font settings
By default, textarea are set with a monospace font */
/* font: 1em sans-serif; */
/* To give the same size to all text field */
width: 200px;
/* -moz-box-sizing: border-box;
box-sizing: border-box; */
/* To harmonize the look & feel of text field border */
border: 1px solid #999;
}
input:focus, textarea:focus {
/* To give a little highligh on active elements */
border-color: OrangeRed;
}
textarea {
/* To properly align multiline text field with their label */
vertical-align: top;
/* To give enough room to type some text */
height: 5em;
/* To allow users to resize any textarea vertically
It works only on Chrome, Firefox and Safari */
resize: vertical;
}
.button {
/* To position the buttons to the same position of the text fields */
padding-left: 90px; /* same size as the label elements */
}
button {
margin: .5em;
font-size: 1em;
text-transform: capitalize;
background-color: red;
color: white;
border: none;
padding: 5px;
border-radius: 2px;
}
#submitbutton {
display: flex;
justify-content: center;
}
/*
Responsive Web Design Projects - Build a Survey Form
Objective: Build a CodePen.io app that is functionally similar to this: https://codepen.io/freeCodeCamp/full/VPaoNP.
Fulfill the below user stories and get all of the tests to pass. Give it your own personal style.
You can use HTML, JavaScript, and CSS to complete this project. Plain CSS is recommended because that is what the lessons have covered so far and you should get some practice with plain CSS. You can use Bootstrap or SASS if you choose. Additional technologies (just for example jQuery, React, Angular, or Vue) are not recommended for this project, and using them is at your own risk. Other projects will give you a chance to work with different technology stacks like React. We will accept and try to fix all issue reports that use the suggested technology stack for this project. Happy coding!
User Story #1: I can see a title with id="title" in H1 sized text.
User Story #2: I can see a short explanation with id="description" in P sized text.
User Story #3: I can see a form with id="survey-form".
User Story #4: Inside the form element, I am required to enter my name in a field with id="name".
User Story #5: Inside the form element, I am required to enter an email in a field with id="email".
User Story #6: If I enter an email that is not formatted correctly, I will see an HTML5 validation error.
User Story #7: Inside the form, I can enter a number in a field with id="number".
User Story #8: If I enter non-numbers in the number input, I will see an HTML5 validation error.
User Story #9: If I enter numbers outside the range of the number input, I will see an HTML5 validation error.
User Story #10: For the name, email, and number input fields inside the form I can see corresponding labels that describe the purpose of each field with the following ids: id="name-label", id="email-label", and id="number-label".
User Story #11: For the name, email, and number input fields, I can see placeholder text that gives me a description or instructions for each field.
User Story #12: Inside the form element, I can select an option from a dropdown that has a corresponding id="dropdown".
User Story #13: Inside the form element, I can select a field from one or more groups of radio buttons. Each group should be grouped using the name attribute.
User Story #14: Inside the form element, I can select several fields from a series of checkboxes, each of which must have a value attribute.
User Story #15: Inside the form element, I am presented with a textarea at the end for additional comments.
User Story #16: Inside the form element, I am presented with a button with id="submit" to submit all my inputs.
You can build your project by forking this CodePen pen. Or you can use this CDN link to run the tests in any environment you like: https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js
Once you're done, submit the URL to your working project with all its tests passing.
Remember to use the Read-Search-Ask method if you get stuck.
*/
Also see: Tab Triggers