Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6968509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:27:39+00:00 2026-05-27T16:27:39+00:00

We are having a discussion as I’m currently fixing an IE7 bug, as <label>

  • 0

We are having a discussion as I’m currently fixing an IE7 bug, as <label> and <input> tags were wrapped in a <p>.

I cannot seem to find any documentation for the correct semantics for tags contained in a <form> tag. I tend to use the following for example,

<form action="" method="post">
  <fieldset>
    <div class="formrow">
      <label for="firstname">Firstname:</label>
      <input type="text" id="firstname" name="firstname" />
    </div>
  </fieldset>
</form>

However, looking at the Zurb Foundation they don’t wrap any elements at all, perhaps for style, but for radio and checkbox they put the <input> inside the <label> which I didn’t think was valid. Although the Zurb page is using HTML5 so perhaps it’s valid on there?

The Twitter Bootstrap tends to go with a double wrapped <div> approach similar to mine. But again they too, wrap the radio and checkbox inputs inside the label.

So, to my question, are there any definitive rules for the semantics of elements inside a <form> tag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:27:39+00:00Added an answer on May 27, 2026 at 4:27 pm

    If you want to know which elements are allowed to be descendants of form elements, I suggest to have a look at the forms section of the HTML4 specification (or go through the equivalent HTML5 section).

    For example, any inline element is allowed inside <label>.:

    <!ELEMENT LABEL - - (%inline;)* -(LABEL) -- form field label text -->
    

    The reason why the input elements are inside their label elements is that clicking the descriptive text also toggles the state of the checkboxes. Afaik you can achieve the same by setting the for attribute properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are currently having a discussion if dataset should go in the data or
Currently there is discussion as to what are the pros and cons of having
I was having a discussion with one of my colleagues about how defensive your
We are having another discussion here at work about using parametrized sql queries in
I've been having a discussion with my coworkers as to whether to prefix overridden
We're having this discussion here. Which is better and why? 1) a php file
Recently I was having a discussion with a friend about Ruby's Proc . You
We've been having a discussion at work about whether to use Domain Objects in
My colleagues and I were having a discussion regarding logic in enums. My personal
I'm having trouble getting ThinkingSphinx to recognize my conditions. My Discussion model includes the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.