My Survey Project

Hello esteemed campers,

This is my survey project, done with HTML and CSS. I am feeling like its share-worthy.

Please spare a moment for a look-in and your suggestions would be of great help moving forward.

Thank you.

Pretty well done. You just need to add for attribute for all your labels.

Your code so far is like:

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

it needs to be like:

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

so, when you click on label the input field get focus.
Otherwise, good job.

1 Like

cheers, I’ll correct that immediately.

Be aware that the for attriute in labels should relate to the id of the input fields not to the name attribute. Check for example the label for age and all radio buttons and checkboxes.

For radio buttons and checkboxes it should be like:

<input type="radio" name="radio-buttons" value="1" id="opt1">
<label for="opt1">Definitely</label>

Happy coding.

Thanks, i get what you mean and noted it as well (corrected the age/number label/id uniformity). I try to achieve a shorter markup if possible and putting labels for all radio and checkboxes would make it kind-of uneasy on the eyes. but i understand your point for good practice though. I’ll proceed with that in mind. Thanks again