Featured
- Get link
- X
- Other Apps
Using Forms for User Input in HTML
Program:
<!DOCTYPE html>
<html>
<body>
<h2>Contact Us</h2>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="4" cols="30"></textarea><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Explanation:
<form>creates a form for user input.<label>defines labels for form elements.<input>creates input fields like text and email.<textarea>creates a multiline text input field.type="text"andtype="email"specify the input types.
1. What HTML tag is used to create a form for user input?
<form>tag is used to create a form for user input.
2. How is the 'Name' input field defined in the HTML form?
- The 'Name' input field is defined using the
<input>tag withtype="text",id="name", andname="name"attributes.
- The 'Name' input field is defined using the
3. What HTML tag is used to create a multiline text input field?
<textarea>tag is used to create a multiline text input field in HTML.
4. What attribute in the
<textarea>tag defines the number of rows for the input field?- The
rowsattribute in the<textarea>tag defines the number of rows for the input field.
- The
5. Which input field type is used for entering an email address?
type="email"is used in the<input>tag to create an input field specifically for entering an email address.
Popular Posts
Breaking Language Barriers: Embracing Multilingual Learning in Coding Education
- Get link
- X
- Other Apps
Comments
Post a Comment