Having trouble with a label appearing before an input.

September 10th 2024 55 views • 1 comments

I'm quite new to html and css and I'm having an issue with a label not appearing before an input. I've done the first set of lessons and am now on the certification project which is to make a survey form of my choosing. I have a few labels already which are appearing fine before the inputs they're id'ed to which is why I'm confused as to why my new label isn't showing now? any help is appreciated and as I've said I'm new to this so please go easy lol I'll paste my code below

<form id="survey-form">
<fieldset id="personal-details">
<label id="name-label" for="name">Enter Your First Name Here <input id="name" type="text" placeholder="John/Jane Doe" required />
<label id="email-label" for="email">Enter Your Email Here<input id="email" type="email" placeholder="[email protected]" required />
<label id="number-label" for="number">Enter Your Number Here <input id="number" type="number" placeholder="07123456789" required />
<label id="activision-id-label" for="activision-id">Enter Your Activision ID Here <input id="activision-id" required />
</fieldset>
<fieldset id="map-preferences">
<label id="dropdown1" for="favourite-core-map">What was your favourite Core map
<select id="favourite-core-map" for="favourite-core-map" required>
<option value="">(Select one) </option>
<option value="1">Derelict</option>
<option value="2">Scud</option>
<option value="3">Skyline</option>
<option value="4">Rewind</option>
</select>
<label id="dropdown2" for="least-favourite-core-map">What was your least favourite Core map
<select id="least-favourite-core-map" name="least-favourite-core-map">
<option value="">(Select one) </option>
<option value="1">Derelict</option>
<option value="2">Scud</option>
<option value="3">Skyline</option>
<option value="4">Rewind</option>
<label id="reason" for="reason" name="reason">Tell us why these maps were your favourite and least favourite maps <input id="reason" type="text">
</fieldset>
</form>

It looks like the issue with your labels not appearing is due to missing closing </label> tags. In HTML, each <label> should be properly closed.