Password Field
Part of the Fundamentals section of Coddy's HTML journey — lesson 38 of 60.
In HTML, a password field is a type of input field used to collect passwords from users.
It is similar to a regular text input field, but the characters typed into a password field are masked, usually displayed as asterisks or dots. This is to prevent others from seeing the password as it is being typed.
To create a password field, you use the <input> tag with the type attribute set to "password".
Here's the basic syntax for creating a password field in HTML:
<input type="password" name="passwordfield">Challenge
EasyCreate an HTML document that includes a form with a password field. The password field should have the name of “userpassword", a type of password" and a placeholder that says "Enter your password". Set the maximum length of the password field to 20 characters.
Cheat sheet
A password field is an input field that masks typed characters (displayed as asterisks or dots) to hide passwords from view.
Create a password field using the <input> tag with type="password":
<input type="password" name="passwordfield">Additional attributes can be used:
placeholder- shows hint textmaxlength- limits character count
<input type="password" name="userpassword" placeholder="Enter your password" maxlength="20">Try it yourself
<!DOCTYPE html>
<html>
<body>
<!-- Write code here -->
</body>
</html>This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
2Text and Formatting
HeadingsParagraphsLine BreaksBold and Italic TextBold and Italic AgainRecap - Formatting8Forms and Inputs Part 1
Form BasicsText InputsInput AttributesPassword FieldLabels for InputsRecap - Basic Form11Event Registration Page
Project OverviewHeader Section9Forms and Inputs Part 2
Radio ButtonsCheckboxesDropdownsButtonsButtons in FormsRecap - Forms #1Recap - Forms #2