HTML – password box

Previous
Next

Creating a password box:

  • A password box (also called password field) is similar to a text box except that the typed characters are displayed as bullets (on Windows) or asterisks (on Mac).
  • To create a password box, we use the <input> tag and set the type attribute to “password”.
Password: <input type="password">
  • By adding the size attribute to the <input> tag, you can control the width of the box.
  • If you require a password that is typically 6 to 10 characters long, do not set the size attribute to 5 (as this will make the box small) or 20 (as this will make the text box big). Instead, you may set the size attribute to 10 or 11.
Password: <input type="password" size="10" >

Try this code snippet:

<!DOCTYPE html>
<html>
	<body>
		<h1>Passowd Input Field</h1>

			<form>
				Enter Mail ID : <input type="email" name="email"><br>
				Enter Password : <input type="password" name="pwd" minlength="8"><br>
			</form>

	</body>
</html>
Previous
Next

Courses Enquiry Form