xhtmllabelxhtml-transitional

Is label tag valid for XHTML 1.0 Transitional?


My question in short is the <label> tag, is it work for XHTML 1.0 Transitional validation ?

For example

<form action="login.php" method="post">
    <label>Username:</label> <input type="text" name="username" id="username" /><br />
    <label>Password:</label> <input type="password" name="password" id="password" /><br/>
    <input type="submit" name="sbmtLogin" value="login" />
</form>

Solution

  • <label> (and validating would have told you this) is but <lable> (which you had before editing) is not.

    It is, however, useless unless you associate it with a form control (via the for attribute or placing the form control as a descendant of the label element).