1

I have this markup:

<form name="access-form" method="post" id="grant-access-page-form">
    <label for="randomized-user-radio">
        <input id="randomized-user-radio" type="radio" name="access-account-type" value="random">
            <div class="access-form--randomized-user access-form-radio-content">
                <img class="access-form-radio-content--image" src="">
                <h3 class="access-form-radio-content--title"><?php esc_html_e( 'Randomized User', 'sprout' ); ?></h3>
                <p class="access-form-radio-content--info"><?php esc_html_e( 'Create a random username that the developers can only use once per session.', 'sprout' ); ?></p>
                <ul class="access-form-radio-content--features">
                    <li class="individual-feature">
                        <p><?php esc_html_e( 'Need to re-create the account.', 'sprout' ); ?></p>
                    </li>
                    <li class="individual-feature">
                        <p><?php esc_html_e( 'Best security, but slower responses.', 'sprout' ); ?></p>
                    </li>
                    <li class="individual-feature">
                        <p><?php esc_html_e( 'Automatically deletes the account, strong security.', 'sprout' ); ?></p>
                    </li>
                </ul>
            </div>
        </input>
    </label>
    <input type="submit" value="<?php esc_html_e( 'Create Developer Account', 'sprout' ); ?>"></input>
</form>

And was wondering if it's correct to have the label wrap my input or it should be the other way around. Way I see it, the input should have a label inside of this, but using the W3 validator, this shows no errors whatsoever.

coolpasta
  • 725
  • 5
  • 19

1 Answers1

0

The way I normally set up my forms is using a definition list

<dl>
    <dt><label for="name">Name</label></dt>
    <dd><input type="text" name="name" id="name" placeholder="John Doe" /></dd>
</dl>

Labels and inputs are grouped using the for & id attributes.

PS: try and make use of htmlentities();

JohnMcClane
  • 128
  • 6