The password field is almost identical in the way that it works to the text field.
Here's what the Password Form page looks like in your web browser.
Again we use a label tag to define the label that is to be associated with our password field. Again we use an input tag to define the actual field.
What we have done is to change the type from text to password and have dropped the value attribute. Specifying a field type of password means that the field will not display the actual characters that are typed in but will instead substitute asterisks. By defining a field this way you avoid the problem of a passer-by seeing the password on the screen as it is being entered. At best from looking at the screen they can see how many characters a password contains but not what those characters are.
This article written by Stephen Chapman, Felgall Pty Ltd.