Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

is <label> tag necessary in this example?

Featured Replies

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;
}

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.

  • 3 weeks later...

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.

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.