Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<main>
	<h1 id="title">freeCodeCamp Survey Form</h1>
	<p id="description">Survey for user suggestions and complaints</p>
	<form id="survey-form" action="">
		<label id="name-label" for="name">Name</label>
		<input id="name" class="box-input" type="text" placeholder="Enter your name" name="name" required>

		<label id="email-label" for="email">Email</label>
		<input id="email" class="box-input" type="email" placeholder="Enter your email" name="email" required>

		<label id="number-label" for="number">
			Age
			<span class="clue">- Optional</span>
		</label>
		<input id="number" class="box-input" type="number" placeholder="10-99" name="age" min=10 max=99>

		<label id="dropdown-label" for="dropdown">What option best describes your current role?</label>
		<select id="dropdown" name="role" required>
			<option disabled selected value="">Select current role</option>
			<option value="student">Student</option>
			<option value="full-job">Full Time Job</option>
			<option value="part-job">Part Time Job</option>
			<option value="learner">Full Time Learner</option>
			<option value="no-answer">Prefer not to say</option>
			<option value="other">Other</option>
		</select>

		
		<fieldset class="options">
			<legend class="form-text">Would you recommend freecodecamp to a friend?</legend>
			<label>
				<input name="recommed" value="definitely" type="radio" checked>
				Definitely
			</label>
			<label>
				<input name="recommed" value="maybe" type="radio">
				Maybe
			</label>
			<label>
				<input name="recommed" value="unsure" type="radio">
				Not sure
			</label>
			<label>
				<input name="recommed" value="no" type="radio">
				No
			</label>
		</fieldset>

		<label id="feature-label" for="fav-feature">What is your favourtie feature of freecodecamp?</label>
		<select id="fav-feature" name="fav-feature" required>
			<option disabled selected value="">Select an option</option>
			<option value="challenges">Challenges</option>
			<option value="projects">Projects</option>
			<option value="open-source">Open Source</option>
			<option value="community">Community</option>
			<option value="videos">Videos</option>
			<option value="blogs">Blogs</option>
			<option value="weekly-emails">Weekly emails</option>
		</select>

		<fieldset class="options">
			<legend class="form-text">What would you like to see improved?</legend>
			<label>
				<input name="improve" value="front-end-projects" type="checkbox">
				Front-end Projects
			</label>
			<label>
				<input name="improve" value="back-end-projects" type="checkbox">
				Back-end Projects
			</label>
			<label>
				<input name="improve" value="data-visualization" type="checkbox">
				Data Visualization
			</label>
			<label>
				<input name="improve" value="challenges" type="checkbox">
				Challenges
			</label>
			<label>
				<input name="improve" value="open-source-community" type="checkbox">
				Open Source Community
			</label>
			<label>
				<input name="improve" value="gitter-help-rooms" type="checkbox">
				Gitter Help Rooms
			</label>
			<label>
				<input name="improve" value="videos" type="checkbox">
				Videos
			</label>
			<label>
				<input name="improve" value="city-meetups" type="checkbox">
				City Meetups
			</label>
			<label>
				<input name="improve" value="wiki" type="checkbox">
				Wiki
			</label>
			<label>
				<input name="improve" value="forum" type="checkbox">
				Forum
			</label>
			<label>
				<input name="improve" value="additional-courses" type="checkbox">
				Additional Courses
			</label>
		</fieldset>

		<p class="form-text">Any comments or suggestions?</p>
		<textarea id="comments" class="box-input" name="comments" placeholder="Enter your comment here..."></textarea>

		<button id="submit" type="submit">Submit</button>
	</form>
</main>

              
            
!

CSS

              
                :root {
	--title-color: #ffffff;
	--text-color: black;
	--primary-color: #00B355;
	--secondry-color: #00401E;
	--form-color: white;
}

body {
  background-color: var(--primary-color);
  color: var(--text-color);
	font-size: 1.2em;
	font-family: "Open Sans", sans-serif;
	transition: font-size 0.5s ease-in-out;
}

main {
	display: flex;
	flex-direction: column;
	align-items: center;
}

#description {
	font-style: italic;
	color: var(--title-color);
	margin-top: 0;
}

#title {
	color: var(--title-color);
	margin-bottom: 0.2em;
}

form {
	background-color: var(--form-color);
	box-shadow: 0 0 12px var(--secondry-color);
	border-radius: 12px;
	width: 60%;
	display: flex;
	flex-direction: column;
	padding: 3%;
	margin-top: 2%;
	margin-bottom: 5%;
	transition: width 0.5s ease-in-out;
}


.form-text {
	margin: 0;
}

input {
	margin: 0;
	border: 2px solid yellow;
}

input:valid, select:valid {
	border-color: var(--primary-color);
}

input:invalid, select:invalid {
	border-color: red;
	box-shadow: none;
}

input:focus:invalid, select:focus:invalid {
	box-shadow: 0 0 10px red;
}

fieldset {
	border-color: var(--primary-color);
}
.box-input, select{
	font-family: inherit;
	font-size: inherit;
	color: #555555;
	width: 100%;
	border-radius: 5px;
	padding: 0.625em;
	margin-top: 1%;
	margin-bottom: 5%;
	align-self: center;
	box-sizing: border-box;
	transition: box-shadow 0.3s ease-in-out;
}

.box-input:focus, select:focus {
	box-shadow: 0 0 10px var(--primary-color);
}

textarea {
	min-height: 128px;
	border: 2px solid var(--primary-color);
	resize: vertical;
}

.options {
	display: flex;
	flex-direction: column;
	margin-bottom: 3%;
	margin-top: 1%;
}

input[type=checkbox], input[type=radio] {
	min-height: 1.25em;
	min-width: 1.25em;
	margin-right: 0.5em;
	-webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
	position: relative;
	color: var(--primary-color);
  width: 1em;
  height: 1em;
  border: 1px solid gray;
	cursor: pointer;
}

input[type=checkbox]:hover, input[type=radio]:hover {
	border-color: var(--secondry-color);
	color: var(--secondry-color);
}

input[type=checkbox]::before, input[type=radio]::before {
	content: "✔";
	position: absolute;
  font-size: 1.2em;
  right: 0;
  top: -0.3em;
  visibility: hidden;
}

input[type=checkbox]:checked::before, input[type=radio]:checked::before {
  /* Use `visibility` instead of `display` to avoid recalculating layout */
  visibility: visible;
}

input[type=radio] {
	border-radius: 50%;
}

input[type=radio]::before {
  content: "✗";
  right: 0.05em;
}

button {
	height: 3em;
	border: none;
	border-radius: 2px;
	cursor: pointer;
	background: var(--primary-color);
	font-size: 1em;
	color: var(--title-color);
	margin-top: 2%;
}

@media (max-width: 600px) {
	body {
		font-size: 0.75em;
	}
	h1 {
		font-size: 1.5em;
	}
	form {
		width: 75%;
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console