June 25, 200818 yr I have a contact.html page with a form. the form is made with html, styled with css and has a php script that should make the things work. I did not added a <label> tag in html. I studied a lot of page sources from a variety of websites. a lot of web sites did not use this tag in their html. I just need to know if it's ok or not. It's odd anyways. And I think there is a different tag syntax between HTML and XHTML. Don't know for sure, maybe you guys do <div class="contact-area"> <form method="post" action="form-process.php"> Name <input type="text" name="name" /><br /> Company <input type="text" name="company" /><br /> Telephone <input type="text" name="telephone" /><br /> E-mail <input type="text" name="email" /><br /> Message <textarea name="message" rows="10" cols="30"></textarea><br /> <input type="submit" name="submit" value="TRIMITE" class="submit-button" /> </form> </div> #content .contact-area { float:left; width:405px; } #content .contact-area input, .contact-area textarea { padding:2px; width:362px; font-family:Trebuchet MS; font-size:12px; margin:0px 0px 10px 0px; border:2px solid #bdbdbd; } #content .contact-area textarea { height:90px; } #content .contact-area input.submit-button { width:80px; font-weight:bold; background:#bdbdbd; border:none; }
June 25, 200818 yr Personally I'd always use the 'label' and 'for' tags for forms. It helps improve accessibility and it's just good practice. I also find it easier to style forms when using it. Your form will still work without it however.
July 13, 200818 yr Yes, the <label> tags are for accessibility purpose. They lets Screen Reader users access input fields easier. You can also add them to increase conveniency when styline the form.
July 13, 200818 yr Labels are also a clickable area relating to the field they are identified with. For example, a label used with a radio button can be clicked and the radio button will be checked which is another benefit for accessibility. Always use labels with your form.
Create an account or sign in to comment