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.
<html>
<head>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<link href="https://fonts.googleapis.com/css?family=Yellowtail|Montserrat&display=swap" rel="stylesheet">
</head>
<body>
<header style="z-index: 100;">
<h1 class="logo">
Irish Surveys
</h1>
</header>
<main>
<div id="first-div" class="main-card">
<h1 id="title"> Please fill out this survey! </h1>
<form id="survey-form">
<p id="description"> This is a survey designed to learn about how x affects y </p>
<div class="question">
<label for="name" id="name-label">
*Name:
</label>
<div class="answer">
<input required name="name" autofocus id="name" type="text" placeholder=" Your name">
</div>
</div>
<div class="question">
<label for="email" id="email-label">
*Email:
</label>
<div class="answer">
<input required id="email" type="email" placeholder=" Your email">
</div>
</div>
<div class="question">
<label for="number" id="number-label" id="number-label">
Student number:
</label>
<div class="answer">
<input id="number" type="number" min="10000000" max="99999999" placeholder=" Your student number">
</div>
</div>
<div class="question">
<label for="course">
*Select your course:
</label>
<div class="answer">
<select type="dropdown" id="dropdown">
<option disabled value>
<i>Select your course</i>
</option>
<option value="theoreticalPhysics">
Theoretical Physics
</option>
<option value="maths">
Mathematics
</option>
<option value="tsm">
TSM Maths
</option>
<option value="physics">
Physics
</option>
<option value="science">
General Science
</option>
<option value="other">
Other course
</option>
<option value="notInCollege">
Not in undergrad
</option>
</select>
</div>
</div>
<div class="question">
<label for="collegeYear">
*What year are you in / have you completed?
</label>
<div class="answer">
<ul style="list-style: none;" class="radio-list" class="collegeYear">
<li class="radio"> <label>
<input name="collegeYear" type="radio" value="0" class="collegeYear"> Not in college
</label> </li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="1" checked class="collegeYear"> 1st Year
</label></li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="2" class="collegeYear"> 2nd Year
</label></li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="3" class="collegeYear"> 3rd Year
</label></li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="4" class="collegeYear"> 4th Year
</label></li>
<li class="radio"><label>
</label></li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="5" class="collegeYear"> Master's
</label></li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="6" class="collegeYear"> PhD Programme
</label></li>
<li class="radio"><label>
<input name="collegeYear" type="radio" value="7" class="collegeYear"> Higher
</label></li>
</ul>
</div>
</div>
<div class="question">
<label for="uses">
*What do you use this site for?
</label>
<div class="answer">
<ul class="checkbox-list">
<li class="checkbox"><label>
<input name="uses" value="1" type="checkbox">
Checking for Homeworks
</label></li>
<li class="checkbox"><label>
<input name="uses" value="2" type="checkbox">
Looking when assignements are due
</label></li>
<li class="checkbox"><label>
<input name="uses" value="3" type="checkbox">
Looking at lecture notes and slides
</label></li>
<li class="checkbox"><label>
<input name="uses" value="4" type="checkbox">
Quick links to different lecturer pages
</label></li>
<li class="checkbox"><label>
<input name="uses" value="5" type="checkbox">
Reviewing things from previous semesters
</label></li>
<li class="checkbox"><label>
<input name="uses" value="6" type="checkbox">
Downloading my personal notes
</label></li>
<li class="checkbox"><label>
<input name="uses" value="7" type="checkbox">
Seeing what modules I do in my course
</label></li>
<li class="checkbox"><label>
<input name="uses" value="8" type="checkbox">
Catching up on materials
</label></li>
<li class="checkbox"><label>
<input name="uses" value="9" type="checkbox">
Other (please specify):
</label></li>
<li class="other"><label>
<input name="uses" type="text" id="otherUses" placeholder=" Other reasons">
</label></li>
</ul>
</div>
</div>
<div class="question">
<label for="comments"> Do you want any other features to be implemented on my website or have any other comments?
</label>
<div class="answer">
<textarea class="comments" id="comments" placeholder="Suggestions or comments..."></textarea>
</div>
</div>
<br>
<div class="question">
<button id="submit"> Submit Answers </button>
</div>
</form>
</div>
</main>
<footer>
Thank you for taking part in this survey!
</footer>
</body>
</html>
body {
font-family: Montserrat, sans serif;
font-size: 1.5em;
text-align:center;
margin: 0px;
background-color: #ccf;
--lightColor: #ffe;
--darkColor: #1ad;
}
header {
position: fixed;
width: 100%;
padding: 10px 0px;
background-color: #fff;
background-color: var(--lightColor);
z-index: 100;
box-shadow: 0px 0px 4px 3px rgb(0,0,0,0.3);
}
.logo {
margin: 0px;
z-index: 101;
color: green;
color: var(--darkColor);
font-family: 'Yellowtail', cursive;
}
main {
position: flex;
width: 100%;
padding: 20px 0px 10px;
background-color: green;
background-color: var(--darkColor);
align-self: center;
}
footer {
width: 100%;
position: flex;
padding: 10px 0px;
background-color: var(--lightColor);
}
.main-card{
width: 98%;
max-width: 900px;
margin: auto auto 1em auto;
position: flex;
align-self: center;
background-color: white;
background-color: var(--lightColor);
box-shadow: 0px 3px 3px 3px rgb(0,0,0,0.3);
}
#first-div {
margin-top: 3.5em;
}
#title {
padding: 32px 0px 0px;
}
.question {
margin: 10px;
width: 100%;
}
.question > label {
width: 39%;
text-align: right;
display: inline-block;
vertical-align: top;
}
.question > .answer {
display: inline-block;
margin-left: 1%;
width: 57%;
text-align: left;
}
input, select, textarea, button {
font-size: 1em;
}
input[type="radio"], input[type="checkbox"] {
width: 0.8em;
height: 0.8em;
}
form {
padding-bottom: 32px;
}
.radio-list, .checkbox-list {
list-style: none;
margin: 0px;
padding-left: 0px;
}
.comments {
min-height: 4.1em;
width: 90%;
resize: vertical;
margin-top: 5px;
}
button {
background-color: green;
background-color: var(--darkColor);
padding: 5px;
border: 10px solid var(--darkColor);
border-radius: 1em;
color: white;
font-weight: bold;
}
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
Also see: Tab Triggers