HTML <input> type Attribute

Example An HTML form with two different input types; text and submit: <form action=”/action_page.php”> Username: <input type=”text” name=”usrname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The type attribute specifies the type of <input> element to display. The default type is text. Tip: The type attribute is not a required attribute, but we […]

HTML <input> align Attribute

Example An HTML form with an image as a submit button. The submit button is aligned to the right: <form action=”/action_page.php”> First name: <input type=”text” name=”fname”><br> <input type=”image” src=”submit.gif” alt=”Submit” align=”right” width=”48″height=”48″> </form> Try it Yourself » Definition and Usage The align attribute is only used with <input type=”image”> and it specifies the alignment of the image input according to surrounding elements. Browser Support […]

HTML <input> Tag

Example An HTML form with three input fields; two text fields and one submit button: <form action=”/action_page.php”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The <input> tag specifies an input field where the user can enter data. <input> elements are used within a <form> element to declare input controls that […]

HTML Input Types

This chapter describes the different input types for the <input> element. Input Type Text <input type=”text”> defines a one-line text input field: Example <form> First name:<br> <input type=”text” name=”firstname”><br> Last name:<br> <input type=”text” name=”lastname”> </form> Try it Yourself » This is how the HTML code above will be displayed in a browser: First name: Last name: Input Type Password <input type=”password”> defines […]