Skip to content

Instantly share code, notes, and snippets.

@loicpw
Created January 18, 2019 00:57
Show Gist options
  • Save loicpw/79acbed5e1451585347e5cd40920d02e to your computer and use it in GitHub Desktop.
Save loicpw/79acbed5e1451585347e5cd40920d02e to your computer and use it in GitHub Desktop.
Responsive Web Design Projects - Build a Survey Form
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!--
Hello Camper!
For now, the test suite only works in Chrome! Please read the README below in the JS Editor before beginning. Feel free to delete this message once you have read it. Good luck and Happy Coding!
- The freeCodeCamp Team
-->
<head>
<title>build a survey form - freecodecamp</title>
</head>
<body>
<header>
<section class="title-text">
<h1 id="title">Survey Form</h1>
<p id="description" class="title-text"><em style="font-size: 90%;">Let us know how we can improve freeCodeCamp</em></p>
</section>
</header>
<main>
<form id="survey-form">
<section id="survey-fields">
<!-- identification fields -->
<label for="name" id="name-label">* Name:</label>
<input id="name" type="text" placeholder="enter your name" required>
<label for="Email" id="email-label">* Email:</label>
<input id="email" type="email" placeholder="enter your email" required>
<label for="number" id="number-label">* Age:</label>
<input id="number" type="number" placeholder="enter your age" min=1 max=125 required>
<!-- Which option best describes your current role -->
<label for="dropdown">Which option best describes your current role?</label>
<select id="dropdown" form="survey-form">
<option value="" disabled selected>select an option</option>
<option value="student">Student</option>
<option value="full-time-job">Full time job</option>
<option value="full-time-learner">Full time learner</option>
<option value="prefer-not">Prefer not to say</option>
<option value="other">Other</option>
</select>
<!-- How likely is that you would recommend freeCodeCamp to a friend -->
<label for="recommendation">* How likely is that you would recommend freeCodeCamp to a friend?</label>
<fieldset id="recommendation">
<label for="r_definitely"><input type="radio" name="recommend" id="r_definitely" value="definitely" required>Definitely</label>
<label for="r_maybe"><input type="radio" name="recommend" id="r_maybe" value="maybe" required>Maybe</label>
<label for="r_not_sure"><input type="radio" name="recommend" id="r_not_sure" value="notsure" required>Not sure</label>
</fieldset>
<!-- What do you like most in FCC -->
<label for="likethemost">What do you like most in FCC:</label>
<select id="likethemost">
<option value="" disabled selected>select an option</option>
<option value="challenges">Challenges</option>
<option value="projects">Projects</option>
<option value="community">Community</option>
<option value="open-source">Open Source</option>
</select>
<!-- Things that should be improved in the future -->
<label for="improvements">Things that should be improved in the future:</label>
<fieldset id="improvements">
<legend>(<em>Check all that apply</em>)</legend>
<label for="c-fep"><input type="checkbox" name="improve-checks" id="c-fep" value="fep">Front-end Projects</label>
<label for="c-bep"><input type="checkbox" name="improve-checks" id="c-bep" value="bep">Back-end Projects</label>
<label for="c-datav"><input type="checkbox" name="improve-checks" id="c-datav" value="datav">Data Visualization</label>
<label for="c-chlgs"><input type="checkbox" name="improve-checks" id="c-chlgs" value="chlgs">Challenges</label>
<label for="c-osc"><input type="checkbox" name="improve-checks" id="c-osc" value="osc">Open Source Community</label>
<label for="c-ghr"><input type="checkbox" name="improve-checks" id="c-ghr" value="ghr">Gitter help rooms</label>
<label for="c-vid"><input type="checkbox" name="improve-checks" id="c-vid" value="vid">Videos</label>
<label for="c-meet"><input type="checkbox" name="improve-checks" id="c-meet" value="meet">City Meetups</label>
<label for="c-wiki"><input type="checkbox" name="improve-checks" id="c-wiki" value="wiki">Wiki</label>
<label for="c-forum"><input type="checkbox" name="improve-checks" id="c-forum" value="forum">
Forum</label>
<label for="c-addcours"><input type="checkbox" name="improve-checks" id="c-addcours" value="addcours">Additional Courses</label>
</fieldset>
<!-- Any Comments or Suggestions -->
<label for="comments">Any Comments or Suggestions?</label>
<textarea style="height:50px;resize:vertical;" id="comments" placeholder="enter a comment"></textarea>
</section>
<!-- submit -->
<button id="submit">submit</button>
</form>
</main>
</body>

Responsive Web Design Projects - Build a Survey Form

Responsive Web Design Projects - Build a Survey Form - freecodecamp

A Pen by Loïc Peron on CodePen.

License.

// !! 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.
@import url(https://fonts.googleapis.com/css?family=Raleway:400,500);
body {
--background-c: hsl(210, 45%, 60%);
background-color: var(--background-c, lightgray);
display: flex;
flex-direction: column;
font-family: "Raleway", Helvetica, sans-serif;
}
@media (max-width: 400px) {
body {
font-size: 13px;
}
}
h1 {
margin-bottom: 5px;
}
header {
padding-bottom: 15px;
position: fixed;
background-color: var(--background-c, lightgray);
width: 100%;
z-index: 1;
top: 0%;
}
main {
background-color: hsl(200, 60%, 100%);
height: 100%;
max-width: 900px;
margin: auto;
margin-bottom: 80px;
padding-bottom: 10px;
padding-top: 5px;
position: relative;
top: 80px;
}
@media (max-width: 400px) {
main {
top: 65px;
}
}
.title-text {
margin: auto;
margin-top: -5px;
text-align: center;
}
#description {
margin-top: 10px;
}
#survey-form {
display: flex;
flex-direction: column;
align-items: center;
}
#survey-fields {
margin-left: 10%;
margin-right: 10%;
margin-top: 10px;
margin-bottom: 10px;
display: grid;
grid-gap: 10px;
}
@media (max-width: 600px) {
#survey-fields {
grid-template-columns: 1fr;
}
label {
text-align: left;
}
}
@media (min-width: 600px) {
#survey-fields {
grid-template-columns: 1fr 1fr;
}
label {
text-align: right;
}
}
fieldset {
display: flex;
flex-direction: column;
align-items: flex-start;
border: 0;
min-width: 100%;
}
fieldset label:hover {
font-weight: bold;
}
#submit {
margin: auto;
background-color: var(--background-c, lightgray);
border-radius: 8px;
padding: 5px 12px 5px 12px;
margin-top: 5px;
font-size: 85%;
}
@sharonrosario
Copy link

nice thank you ....can you tell where can i find backend for such survey forms
and like admin section those reponses will recieve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment