Build a Checkout Page - Build a Checkout Page

Tell us what’s happening:

  1. All of your input elements that aren’t a type of submit should have a label element associated with them.

I have 4 non-submit input elements (name, credit card #, expiry, cvv) and they all have labels. Should the label come after the input element?

Your code so far

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Checkout Page</title>
  </head>
  <body>    
        <h1 id="title">Checkout</h1>
  <section>
      <h2>Your Cart</h2>
      <img src="https://cdn.freecodecamp.org/curriculum/labs/cube.jpg" alt="Multi-Colored Rubix Cube">
      <figcaption>Multi-Colored Rubix Cube</figcaption>
    </section>
    <section>
        <h2>Payment Information</h2>
        <form method="post" action="https://checkout.freecodecamp.org" id="payment">
        <div class="form-group">
            <label id="card-name" for="name">Cardholder Name</label>
            <input required type="text" id="card-name" class="form-control" name="card-name" aria-required="true">
        </div>
        <div class="form-group">
            <label id="card-number" for="number">Credit Card Number</label>
            <input required type="number" id="card-number" class="form-control" name="card-number" min="12" max="16" aria-required="true">
        </div>
        <div class="form-group">
            <label id="expiration" for="number">Expiry Date</label>
            <input required type="number" id="expiration" class="form-control" name="number" min="4" max="4" placeholder="MM/YY" aria-required="true">
        </div>
        <div class="form-group">
            <label id="cvv" for="number">CVV</label>
            <input required type="number" id="cvv" class="form-control" name="number" min="2" max="6" aria-required="true">
        </div>
    <div class="form-group">
        <button type="submit" id="submit" class="submit-button">Submit</button>
    </div>
    </form>
    </section>
  </body>
</html>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0

Challenge Information:

Build a Checkout Page - Build a Checkout Page

Please review this lecture again.

https://www.freecodecamp.org/learn/full-stack-developer/lecture-importance-of-accessibility-and-good-html-structure/why-is-it-important-for-inputs-to-have-an-associated-label