Complete HTML Form Tag Tutorial with Examples on Tutorialspoint

The `

` tag in HTML is a fundamental element used to create interactive forms for user input on web pages. It's a container for various form elements like input fields, text areas, buttons, select options, and more. TutorialsPoint.com offers a comprehensive guide on the `` tag, which we'll explore in detail here.

HTML Formatting โ€” Text Formatting Tags โ€” TutorialBrain
HTML Formatting โ€” Text Formatting Tags โ€” TutorialBrain

Before diving into the tag's attributes and uses, let's start with a basic example of how to use the `` tag in HTML:

HTML TAG
HTML TAG

Basic Structure of the `` Tag

The `` tag must have an opening `` tag and a closing `` tag. The content between these two tags is the form that users can interact with.

Quick HTML Tags Cheat Sheet
Quick HTML Tags Cheat Sheet

Here's a simple form example with a text input and a submit button:

<form>
  <label for="fname">First name</label>
  <input type="text" id="fname" name="fname">
  <input type="submit" value="Submit">
</form>

Attributes of the `
` Tag

the ultimate guide to creating and formating tags
the ultimate guide to creating and formating tags

The `` tag has several attributes, but the most crucial ones are `action` and `method`.

  1. action: Specifies the URL to which the form-data will be submitted. If this attribute is not specified, the form will not submit anywhere.
    <form action="/submit_form">
  2. method: Specifies the HTTP method used to submit the form-data: `get` or `post`. The default method is `get`.
    <form action="/submit_form" method="post">

Nesting Form Elements

List of HTML Tags
List of HTML Tags

Inside the `` tag, you can nest various form elements like ``, `