Learn HTML Forms by Building a Registration Form - Step 18

Tell us what’s happening:
I was able to solve this, but I have a question: why is there a slash (“/”) at the end of the opening input element?
In the previous exercise, I put in <“input><”/input> for all 4 labels. When I then move on, it got changed in this exercise here to <“input /><”/input>. (without the " of course, that was so it’d show the code.)

Why is that slash there in the input element? is this something I should note for a specific reason?

thank you for your help, I appreciate it.

Your code so far

<!-- file: index.html -->
<!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'>

<!-- User Editable Region -->

        <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>

<!-- User Editable Region -->

/* 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:109.0) Gecko/20100101 Firefox/110.0

Challenge: Learn HTML Forms by Building a Registration Form - Step 18

Link to the challenge:

input is a self-closing element.
You do not need the closing tag for it.
There are 2 ways to write it:
<input />

your choice and it just so happens the exercise creators used the version with the slash

1 Like

that is great to know. thank you so much! appreciate the quick response.

1 Like

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