Learn HTML Forms by Building a Registration Form - Step 28

Tell us what’s happening:

Kindly help with the legend element here. I have placed the legend below the second fieldset as required but I still can’t get through.

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'>
      <fieldset>
        <label for="first-name">Enter Your First Name: <input id="first-name" type="text" required /></label>
        <label for="last-name">Enter Your Last Name: <input id="last-name" type="text" required /></label>
        <label for="email">Enter Your Email: <input id="email" type="email" required /></label>
        <label for="new-password">Create a New Password: <input id="new-password" type="password" pattern="[a-z0-5]{8,}" required /></label>
      </fieldset>

<!-- User Editable Region -->

      <fieldset>
        <label><input type="radio" name="account-type" /> Personal</label>
        <label><input type="radio" name="account-type" /> Business</label>
      </fieldset>
      <legend checked="Personal"> Account type (required) </legend>
      
     

<!-- User Editable Region -->

      <fieldset></fieldset>
      
      <input type="submit" value="Submit" />
    </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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Challenge Information:

Learn HTML Forms by Building a Registration Form - Step 28

Couple of things.

First, the lesson says to add it below the second fieldset element but what it actually wants is it placed under the opening tag of the fieldset element before the input elements. Second, checked is a value to assign to the Personal input.

Two problems I see:

  1. legend has to be a child of the fieldset so the text “second fieldset” is about the second fieldset argument. Your code has to be between fieldset and /fieldset

  2. The legend doesn´t need the checked argument. Read the text again closely and you will see where the “checked” attribute needs to go.

I have tried this but it’s still not going through

Personal Business Account type (required)


I’m stuck here. I can’t seem to get it

image
Hope this helps.

Happy coding

1 Like

I got it. Thanks a lot

2 Likes

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