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>
Wrong it is not, but the second is semantic and especially better to use for people with restrictions
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
I would write the first name as a placeholder in the input. Saves space and looks more modern. You can then style by css.