Form Input Field Markup and Layout
In this lesson, we will Iearn how form fields are structured in HTML.
We'll cover the following...
Linking labels and input fields through id attributes
When creating a form field, two HTML elements have to be linked:
- an
<input>
field - and a
<label>
Most software developers know that linking the two HTML elements can be performed by giving the label a for
attribute, and giving an id
attribute for the corresponding input
field:
<label for="name-field">Name</label>
<input type="text" id="name-field" name="name" />
Whenever this link is established, ...