Leave out form html label?

Hello, I have the following question:

My lecturer taught us the following notation in class:

 <form action="suche.html"> Vorname: <input type="text" name="vorname"> </form>

We're not using a label here (although "radio" or "checkbox" is used instead.) Is this notation incorrect? You can see examples of labels everywhere on the internet when using the "text" input type:

 <form action="suche.html"> <label for="vorname"> Vorname:<input type="vorname" id="vorname"> </label> </form>
(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
3 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
elmex7
1 year ago

Wrong it is not, but the second is semantic and especially better to use for people with restrictions

GamersGame
1 year ago

First name:

<=form >

That’s what you did 10 years ago.

I would use variant 2:

First name:

<=form >

And type=”first name= there is not.

These are: https://www.w3schools.com/html/html_form_input_types.asp

MooKuh
1 year ago

I would write the first name as a placeholder in the input. Saves space and looks more modern. You can then style by css.