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 <form> Tag

Example An HTML form with two input fields and one submit button: <form action=”/action_page.php” method=”get”> 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 » More “Try it Yourself” examples below. Definition and Usage The <form> tag is used to create an HTML form for user input. The <form> element can contain one or more of the […]

HTML <label> Tag

Example Three radio buttons with labels: <form action=”/action_page.php”> <label for=”male”>Male</label> <input type=”radio” name=”gender” id=”male” value=”male”><br> <label for=”female”>Female</label> <input type=”radio” name=”gender” id=”female” value=”female”><br> <label for=”other”>Other</label> <input type=”radio” name=”gender” id=”other” value=”other”><br><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The <label> tag defines a label for an <input> element. The <label> element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if […]

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 […]