Learn HTML Forms by Building a Registration Form - Step 18

Tell us what’s happening:

Step 17 of building a registration form said my code was good but then it was changed in step 18.
Describe your issue in detail here. My issue is with the input elements. In step 17 I entered them such as:

      <fieldset>
        <label>Enter Your First Name: <input></label>
        <label>Enter Your Last Name: <input></label>
        <label>Enter Your Email: <input></label>
        <label>Create a New Password: <input></label>
      </fieldset>

It said my code was good and allowed me to go to step 18 but on step 18 the input labels were changed to something I haven’t studied yet. I tried searching google but couldn’t find the answer.

This is what step 18 changed it to:

    <fieldset>
        <label>Enter Your First Name: <input /></label>
        <label>Enter Your Last Name: <input /></label>
        <label>Enter Your Email: <input /></label>
        <label>Create a New Password: <input /></label>
      </fieldset>  

My question is why has the input element which is a self closing tag been changed from
<input> to <input /> after I was told I was correct and allowed to move on. I noticed another space before the backslash. Also the backslash is at the end after a space and not in the front of the input element which is how I have seen it in closing elements even though input is a self closing element to my understanding.
So my question is do I need to be concerned with this at this point and the answer will turn up later or is there a reason for this? Thank you in advance

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: <input /></label>
        <label>Enter Your Last Name: <input /></label>
        <label>Enter Your Email: <input /></label>
        <label>Create a New Password: <input /></label>
      </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 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0

Challenge Information:

Learn HTML Forms by Building a Registration Form - Step 18

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!

MOD EDIT: Removed solution

This is the correct code :3

Hello @ReesesPieces !

I can understand your confusion with the change.

Your code passed because the program could see that it was an input element which is self closing, and it automatically added the closing / to the code.

Basically, self closing means it does not require a second closing tag. It only requires one tag. And, I believe, in some instances we may need to make it <input/> rather than <input>for the program to recognize it.

I hope this helps you understand a bit better.

1 Like

@alantobilla97

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

2 Likes

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