Should we use <label> for every <input>?

Posted by metal-gear-solid on Stack Overflow See other posts from Stack Overflow or by metal-gear-solid
Published on 2010-05-24T08:32:25Z Indexed on 2010/05/24 8:41 UTC
Read the original article Hit count: 176

Should we use <label> for every input? , even for submit button and keep hidden thorough css if we don't want to show label.

or no need of label for submit button?

.hide {display:none}

<fieldset>
  <legend>Search</legend>
    <label for="Search">Search...</label>
      <input value="" id="Search" name="Search">
    <label for="Submit" class="hide">Submit</label>
      <input type="submit" value="Go!" name="submit" id="submit">
</fieldset>

or we should use like this (no label for submit)

<fieldset>
  <legend>Search</legend>
    <label for="Search">Search...</label>
      <input value="" id="Search" name="Search">
      <input type="submit" value="Go!" name="submit" >
</fieldset>

© Stack Overflow or respective owner

Related posts about css

Related posts about XHTML