HTML HTML Forms Choosing Options Radio Buttons

Hi, will it matter if I write the elements in different order? I tried to preview it and it turned okay. Just want to..

Nick in the video just put the label tag right after the input tag side by side. The code looks very long for me. I tried to put the label tag in a different line for ease of coding and viewing, and it turned okay when I previewed it. But is it still correct though? In terms of proper semantics?

<form action="" method="POST"> <h1>Sign up Form</h1> <fieldset> <legend><span class="number">1</span>Your basic info</legend> <label for="name">Name</label> <input type="text" id="name" name="user_name">

    <label for="mail">Email</label>
    <input type="email" id="mail" name="user_email">

    <label for="password">Password</label>
    <input type="password" id="password" name="user_password">

    <label>Age:</label>
    <input type="radio" id="under13" value="under13" name="userage">
    <label for="under13" class="light"> Under 13</label> <br>
    <input type="radio" id="over13" value="over13" name="userage">
    <label for="over13" class="light">Over 13</label>
    </fieldset>

2 Answers

Steven Parker
Steven Parker
176,347 Points

In most cases, blank lines in HTML code have no effect on the rendered page, so you can use them as you like to make the code more readable.

The same is true of spacing used to illustrate nesting levels.

Thank you.