html · level 2 · unit 1 · lesson 2
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
The right type gives visitors the right tools.
You met email, number and checkbox. There are more. type="tel" is for phone numbers, so phones show a instead of letters. type="url" is for web addresses.
type="date" opens a , a little calendar, so nobody has to wonder whether you want the day or the month first. type="time" does the same for times.
type="password" hides each letter behind a dot, so people nearby cannot read it. The right type costs you nothing and saves every visitor effort.
<form>
<label for="phone">Phone</label>
<input type="tel" id="phone" name="phone">
<label for="day">Day</label>
<input type="date" id="day" name="day">
<label for="secret">Password</label>
<input type="password" id="secret" name="secret">
</form> Press show my page to see it here.
Leave type out, or write type="text", and you get the ordinary box. Browsers that do not know a type show that too.
guess first
What does this box look like?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<label for="when">Booking day</label>
<input type="date" id="when" name="when">
your turn
Your turn. Fix up a delivery form.
Choose the right type for each box: a phone number on line 3 and a delivery day on line 5.
Press show my page to see it here.
- the phone box brings a keypadnot checked yet
- the day box brings a calendarnot checked yet
fix it
Everyone can read the password. Can you fix it?
Press show my page to see it here.
- the password hides behind dotsnot checked yet
- the username stays readablenot checked yet
- Which of the two boxes should hide what people type?
- Line 5 uses the ordinary text box for the password.
- Change line 5 to
type="password", then press run.
nailed it
your boxes fit their answers. :D
telbrings a keypad on phones.dateandtimeopen pickers, so nobody guesses the format.passwordhides each letter behind a dot.
new words in your collection
- keypad
- date picker
This lesson isn’t saved. A free account remembers every lesson you finish.