Nesting <label>

Hi @teamie !

If you run your code through the html validator then you will find that you can’t do that because it will come back with errors.

Try running this code and you can see the error messages for yourself.

<!DOCTYPE html>

<html lang="en">

<head>
  <meta charset="utf-8">

  <title>Labels</title>

</head>

<body>
  <label for="sex"> Sex : <label for="male"><input type="radio" name="sex" id="male"></label> <label for="female"><input type="radio" name="sex" id="female"></label></label>
</body>

</html>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like