Learning to build the Survey Form

Hi All,

I have been actively trying to learn web development for about a year now on and off. I have tried to learn via many different resource however i was struggling to piece everything together so i decided to return back to the “responsive web design” course. I have followed through all the tutorials and completed the Survey form.

I have been struggling with the CSS styling on the Survey Form, the form is functional and does work. I am able to proceed with the other tutorials however i am wondering if i should go back and try to complete the Survey to replicate it as best as possible with CSS.

In addition is it considered cheating if i inspect the Survey form on https://survey-form.freecodecamp.rocks/.

I can see their is div elements used to break up the form into its respected grouping. However as of far following the FCC tutorials we have only covered sections, articles but not so much on divs.

What would be advisable to stay and finish it as best as possible or move on? I have pasted my code below, please let me know your thoughts.

Also do let me know if i am on the right path or if i have missed anything.

Any suggestions or tips will be highly appreciated.

Many Thanks,

Serk

HTML:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>survey-form.freecodecamp.rocks</title>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<h1 id="title">freeCodeCamp Survey Form</h1>

<p id="description">Thank you for taking the time to help us improve the platform</p>

<div>

<form id="survey-form">

<label id="name-label">Name<input id="name" type="text" placeholder="Enter your name" required></input> </label>

<label id="email-label">Email<input id="email" type="email" required placeholder="Enter your emmail"></input></label>

<label id="number-label">Age<input id="number" type="number" min="1" max="120" placeholder="Age" pattern="[0-9]"></input></label>Which option best describes your current role?

<select id="dropdown">

<option>Select a current role</option>

<option>Student</option>

<option>Full Time job</option>

<option>Full Time learner</option>

<option>Prefer Not to say</option>

<option>Other</option>

</select>

<label><input type="radio" name="radio-btn"value="1"></input>Definitely</label>

<label><input type="radio" name="radio-btn" value="2"></input>Maybe</label>

<label><input type="radio" name="radio-btn" value="3"></input>Not Sure</label>

<select id="dropdown">

<option>Select an option</option>

<option>Challenges</option>

<option>Projects job</option>

<option>Community</option>

<option>Open Source</option>

</select>

<label>What would you like to see improved? (Check all that apply)

<label><input type="checkbox" value="1">Front-end Projects</input></label>

<label><input type="checkbox" value="2">Back-end Projects</input></label>

<label><input type="checkbox" value="3">Data Visualization</input></label>

<label><input type="checkbox" value="4">Challenges</input></label>

<label><input type="checkbox" value="5">Open Source Community</input></label>

<label><input type="checkbox" value="6">Gitter help rooms</input></label>

<label><input type="checkbox" value="7">Videos</input></label>

<label><input type="checkbox" value="8"></input>City Meetups</label>

<label><input type="checkbox" value="9"></input>Wiki</label>

<label><input type="checkbox" value="10"></input>Forum</label>

<label><input type="checkbox" value="11"></input>Additional Courses</label>

</label>Any comments or suggestions?

<textarea></textarea>

<input id="submit" type="Submit"></input>

</form>

</body>

</div>

</html>

CSS:

body{
  background-image: url(https://cdn.freecodecamp.org/testable-projects-fcc/images/survey-form-background.jpeg);
  font-family: 'Poppins', sans-serif;
/* linear-gradient:(115deg, rgba(58, 58, 158, 0.8), rgba(136, 136, 206, 0.7)); */
background-size: cover;
background-repeat: no-repeat;
background-position: center

}

div{
background-color: #1b1b32;
border-radius: 10px;
color: white;
padding: 30px;
width:600px;
margin:0 auto;

}

#title, #description{
  text-align: center;
  color: white;
}

label {
  display:block;
}

input[type="submit"]{
  display:block;
  background-color: green;
  color:white;
  margin-top: 20px;
  padding: 10px 0;
}

#name, #email, #number, #dropdown,#survey-form, textarea, checkbox{
  display: block;
  width:100%;
  
  
}

input[type="submit"]{
  width: 100%;
  margin: 20px 0 0 0;

}

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

You shouldn’t inspect the sample project.
The goal is not to replicate the sample

The goal is to create your own version of the survey form.
It is totally fine if your version looks different. And you will end up learning more that way anyway.

I would personally suggest adding some more spacing between the different inputs so it doesn’t look so crowded.

At quick glance, I spot a couple of errors like adding closing tags for inputs here

<label><input type="checkbox" value="11"></input>

inputs are self closing

Running your code through an HTML validator will help you catch this errors

Also, a big thing that is missing is properly indented code.
indenting your HTML will make it much easier to read for other developers

for example:

<head>

  <meta charset="utf-8">

  <title>survey-form.freecodecamp.rocks</title>

  <link rel="stylesheet" href="styles.css">

</head>

Same message applied for your css here

When you are working in the fcc editor, you can right click you mouse and format the document

Otherwise, you can move onto the next projects.

Throughout your journey, you will be building a lot projects and most of them earlier on will just be for practice to help you improve.

hope that helps!

One more note about this sample project.

This one is using flexbox and a combination of divs to achieve the look that was after.

Flexbox is introduced in this later project here

If you are interested in learning flexbox more on your own and then adding that to your project, that is fine.
If you get stuck, you can post your code and the forum can help you debug it.

divs will come up more later on in the curriculum.

But in general, divs are generic containers that hold no semantic meaning. They are often used to group other html content.

here is a pretty detailed post on the div element and when to use it

1 Like

Hi jwilkins.oboe,

Thank you for your swift response and feedback on my code. I do apologise for not correctly pasting my coding when creating a post.

I only inspected the code after i completed the survey form as i was curious how the spacing between the lables/ inputs elements where achieved, i did not copy the structure at all.

Thank you for your comments about input i was not aware that they were self closing and i will defiantly keep that in mind moving forward :grinning:.

I also would to thank you on providing the Markup Validation service this is highly appreciated.

Again i do apologise for not indenting my code i was not aware i code do that within th editor however moving forward i will strive to remember this as well.

I would like to move forward atm as i have made no further progress today but defiantly will return to the links you pasted later on to do a bit of reading

Thank you for all your suggestions/ feedback and links this has been most helpful and i highly appreciate your response on this matter as i was stuck all day and was feeling frustrated and slightly demoralised about not progressing with my code.

Many thanks once again,

Serk :grinning:

In that case, then that is fair :+1:

That’s ok.
It is common beginner mistake.
I made the same mistakes when I was first learning too :slight_smile:

I think a big part of your frustrations are actually coming from the fact that you are trying to do all of this on your own.

But the fact of the matter is that, no one learns to code 100% on their own.
Even the best developers receive help along the way.

I would suggest reaching out to the forum more often when you get stuck.
You will find yourself learning how to ask questions better which is a vital skill of the job.
You will also start to progress much faster that way too because people can help you get unblocked and you will understand concepts quicker.

Hope that helps :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.