Learn HTML Forms by Building a Registration Form - Step 18

Tell us what’s happening:

Im not sure what i am doing wrong. I used what they told me to but it is not working.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Registration Form</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <h1>Registration Form</h1>
    <p>Please fill out this form with the required information</p>
    <form method="post" action='https://register-demo.freecodecamp.org'>

<!-- User Editable Region -->

      <fieldset>
        <label>Enter Your First Name:</label>
        <input for="first-name"></input>
        <label>Enter Your Last Name:</label>
        <input for="last-name"></input>
        <label>Enter Your Email:</label>
        <input for="email"></input>
        <label>Create a New Password:</label>
         <input for="new-password"></input>
      </fieldset>

<!-- User Editable Region -->

      <fieldset></fieldset>
      <fieldset></fieldset>
    </form>
  </body>
</html>
/* file: styles.css */
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
  color: #f5f6f7;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36

Challenge Information:

Learn HTML Forms by Building a Registration Form - Step 18

1 Like

Hi,
input elements don’t take a for attribute. Instead, you add the for attribute in the label elements to connect them with the inputs. The input elements can take an id attribute. So when connecting a label to an input, you should try to match the for attribute’s value to the input’s id.
I hope this helps!

Hello, yes thank you this helped a lot!

For anyone else who dosent understand basically the code should look like this:

Enter Your First Name: Enter Your Last Name: Enter Your Email: Create a New Password:

Making sure the for and id attributes have the same value inorder to connect them

1 Like