HTML Input Attributes
Attributes fine-tune how an input behaves and what it accepts.
You can show placeholder text, mark a field as required, set a starting value, or make a field read-only. These small touches make forms easier and safer to fill in.
Helpful Attributes
Placeholder and Required
A required field with a hint
<!DOCTYPE html>
<html>
<body>
<input type="text" name="city" placeholder="Your city" required>
</body>
</html>Note: A required field stops the form from submitting until the user fills it in.
Exercise: HTML Input Attributes
What does the "placeholder" attribute do on an input?