w3resource logo


HTML form tag and element - HTML tutorials

HTML form tag and element

Secondary Nav

Description

1. HTML form element is used to represent a form in an HTML page.

2. Forms are used to collect data supplied by users in an HTML document.

Syntax

<form> </from> 

Category

HTML form element belongs to HTML forms.

Whether both start and end tags are required

Yes.

Can contain

HTML form element can contain inline elements and other block level elements.

Can reside within

HTML form element can reside within APPLET, BLOCKQUOTE, BODY, CENTER, DD, DEL, DIV, FIELDSET, IFRAME, INS, LI, MAP, NOFRAMES, NOSCRIPT, OBJECT, TD, TH.

Attributes

Attributes specific to this element

action, method, enctype, accept-charset, accept, name.

Identifiers

id, class.

language information and text direction

lang, dir.

Title

Title.

Style

Style.

Target frame information

target.

Events

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout onkeypress, onkeydown, onkeyup.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of using HTML form element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML form tag example - HTML tutorial | w3resource</title>
</head>
<body>
<form name="example_ form" action="html-form-tag-example.html" >
Name: <input type="text" size="30" /><br /><br />
Email: <input type="text" size="30" /><br /><br />
Place: <input type="text" size="10" /><br /><br />
<input type="submit" value="Submit" / >
</form>
</body>
</html>

Result

html form element

View this example in a separate browser window

HTML form tag example.



Join our Question Answer community to learn and share your programming knowledge.