Having problem in "Learn html by building a html Registration Form"

I am having a problem in the lesson of Registration Form on step -18 . i fell that my code is correct why why is the error showing : The first input element should have an id of first-name.


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Registration Form</title>
    <link rel="stylesheet" href="styles.css" />
    <h1>Registration Form</h1>
    <p>Please fill out this form with the required information</p>
    <form method="post" action='https://register-demo.freecodecamp.org'>
        <label>Enter Your First Name: <input id="first-name"></label>
        <label>Enter Your Last Name: <input id="last-name"></label>
        <label>Enter Your Email: <input id="email"></label>
        <label>Create a New Password: <input id="new-password"></label>


body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
  color: #f5f6f7;

label {
  display: block;
  margin: 0.5rem 0;


Pls post a link to the challenge so we can try your code.

I checked the challenge
it also asks you to use the for attribute on element label
link the input elements and the label elements together using the for attribute.
you did everything right until now but you haven’t completed it
EX: < label for=“Alphabet” >

1 Like

sure … here you goo

heloo … Can you explain more clearly … I will appreciate it . :slightly_smiling_face:

1 Like

As mentioned by the previous poster, you have forgotten to add a for attribute to each label element.

The for attribute associates the label with the input. You learned about it back in step 56 of the cat photo app.

1 Like

I can’t be too specific
I’m allowed to give you an example
here’s a hint
to the current code you wrote
label element must also have a for attribute with first-name content as input

1 Like

Thank You !! It worked . :slightly_smiling_face:


You are welcome :hugs:
I’m glad I helped you

Hii… @Overdosse ummm actually i liked that you tried to help me but i didn’t understand what you wanted to say … but there was also on user named hbar1st… the reply he/she sent it worked … i thanked the user … not you …but yeahh I appreciate that you tried to help me … Thank you :slightly_smiling_face: :smiling_face:


:joy::joy::joy: I tried to be as subtle as possible
I don’t want to give you the whole solution
I wanted to let you think
I just gave you a hint
But as i said glad to help you

1 Like

It sounds like there might be an issue with the id attribute of the first input element in your registration form. The error message you’re seeing, “The first input element should have an id of first-name,” suggests that the id of the first input element in your form is not set to “first-name.”

Please check that the id attribute of the first input element is correctly set to “first-name” and also make sure that it is unique across the entire HTML document.

It could also be possible that the input type is not set to “text”
You could also check that the input tag is properly closed and there is no typo in the code.

If you are still facing issues, please share the specific code you have written for the registration form. It will help me understand the problem and provide more specific advice.

HI @sujitmicrosoft !

Welcome to the forum!

This post has already been marked as solved because the OP has arrived at the correct answer. :+1:

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