Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CodePen Home FreecodeCamp_Poject2-Build_a_Survey_Form
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<html>
<head>
<title>Survey||Form</title>
</head>
<body>
<!-----------------------------------Form-heading--------------------------------->
<h1 id="title">Survey Form</h1>
<!-----------------------------------Form-section--------------------------------->
<div id="main-form">
<p id="description">Let us know how we can improve freeCodeCamp</p>
<form id="survey-form" method="GET" action="/action_page.php">
<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="Enter your name" required>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label id="email-label" for="name">* Email: </label>
</div>
<div class="rightTab">
<input type="email" name="email" id="email" class="input-field" required placeholder="Enter your Email">
</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="Currentpost">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="student">Student</option>
<option value="job">Full Time Job</option>
<option value="learner">Full Time Learner</option>
<option value="preferNo">Prefer not to say</option>
<option value="other">Other</option>
</select>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="userRating">* How likely is that you would recommend freeCodeCamp to a friend?</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 in FCC: </label>
</div>
<div class="rightTab">
<select id="most-like" name="mostLike" class="dropdown">
<option disabled selected value>Select an option</option>
<option value="challenges">Challenges</option>
<option value="projects">Projects</option>
<option value="community">Community</option>
<option value="openSource">Open Source</option>
</select>
</div>
</div>
<div class="rowTab">
<div class="labels">
<label for="preferences">Things that should be improved in the future<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">Front-end Projects</label></li>
<li class="checkbox"><input name="prefer" value="2" type="checkbox" class="userRatings">Back-end Projects</li>
<li class="checkbox"><label><input name="prefer" value="3" type="checkbox" class="userRatings">Data Visualization</label></li>
<li class="checkbox"><label><input name="prefer" value="4" type="checkbox" class="userRatings">Challenges</label></li>
<li class="checkbox"><label><input name="prefer" value="5" type="checkbox" class="userRatings">Open Source Community</label></li>
<li class="checkbox"><label><input name="prefer" value="6" type="checkbox" class="userRatings">Gitter help rooms</label></li>
<li class="checkbox"><label><input name="prefer" value="7" type="checkbox" class="userRatings">Videos</label></li>
<li class="checkbox"><label><input name="prefer" value="8" type="checkbox" class="userRatings">City Meetups</label></li>
<li class="checkbox"><label><input name="prefer" value="9" type="checkbox" class="userRatings">Wiki</label></li>
<li class="checkbox"><label><input name="prefer" value="10" type="checkbox" class="userRatings">Forum</label></li>
<li class="checkbox"><label><input name="prefer" value="10" type="checkbox" class="userRatings">Additional Courses</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>
</form>
</div>
<h2>Created by Pappu Kumar Pashi || 6 Aug 2020</h2>
</body>
</html>
// coded by @Pappu Kumar Pashi
const projectName = 'survey-form';
localStorage.setItem('example_project', 'Survey Form');
@import url(https://fonts.googleapis.com/css?family=Raleway:400,500);
html,
body{
background:#a9d7d1;
text-align:center;
font-family: 'Raleway', Helvetica, sans-serif;
min-width:320px;
}
#main-form{
background:rgb(250,250,250);
margin:0 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: 1px solid #c0c0c0;
border-radius: 2px;
}
#userAge {
width: 40px;
}
.userRatings,
input[type="checkbox"] {
float: left;
margin-right: 5px;
}
#submit {
background-color: #59ace0;
border-radius: 4px;
color: white;
font-size: 1em;
height: 40px;
width: 96px;
margin: 10px;
border: 0px solid;
}
#submit:hover{
cursor:pointer;
background:green;
}
.dropdown {
height: 35px;
width: 140px;
padding: 5px;
margin: 10px;
margin-top: 15px;
border: 1px solid #c0c0c0;
border-radius: 2px;
}
.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%;
}
}
h2{
background:tomato;
padding:5px;
}
@media screen and (max-width: 520px) {
.labels {
width: 100%;
text-align: left;
}
.rightTab {
width: 80%;
float: left;
}
.input-field {
width: 100%;
}
select {
width: 100%;
}
h2{
font-size:15px;
padding:2px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment