0
0
HTMLmarkup~20 mins

Input types (text, email, password, number) in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Input Types Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the purpose of the email input type?
Which of the following best describes what the email input type does in an HTML form?
AIt allows users to enter any text without validation.
BIt only accepts numbers and shows a numeric keypad on mobile.
CIt validates that the entered text is in a proper email format.
DIt hides the entered text for privacy, like a password.
Attempts:
2 left
💡 Hint
Think about what makes an email input different from a normal text input.
📝 Syntax
intermediate
1:00remaining
Which input type will show dots instead of characters when typing?
You want to create a password field that hides the characters as the user types. Which input type should you use?
A<input type="password">
B<input type="email">
C<input type="text">
D<input type="number">
Attempts:
2 left
💡 Hint
Passwords should not be visible on screen.
rendering
advanced
1:30remaining
What happens when you use type="number" in an input?
Consider this HTML code:
<input type="number" min="1" max="5" value="3">

What will the user see and be able to do in most modern browsers?
AA text box that accepts any characters, including letters.
BAn email input that validates email format.
CA password field that hides input characters.
DA text box with up/down arrows to increase or decrease numbers between 1 and 5.
Attempts:
2 left
💡 Hint
Think about how number inputs help users pick numbers easily.
accessibility
advanced
2:00remaining
Which attribute improves accessibility for input fields?
You have an input field for email:
<input type="email">

What should you add to make it accessible and clear for screen readers?
AAdd an <code>aria-label</code> or associate a <code>&lt;label&gt;</code> with the input.
BAdd a <code>placeholder</code> attribute only.
CAdd a <code>value</code> attribute with example text.
DAdd a <code>disabled</code> attribute.
Attempts:
2 left
💡 Hint
Labels help screen readers understand the input purpose.
selector
expert
1:30remaining
Which CSS selector targets only input elements of type password?
You want to style only password input fields with a red border. Which CSS selector will do this?
Ainput#password { border: 2px solid red; }
Binput[type=password] { border: 2px solid red; }
Cinput[type=text] { border: 2px solid red; }
Dinput.password { border: 2px solid red; }
Attempts:
2 left
💡 Hint
Attribute selectors match elements by attribute and value.