w3resource

HTML enctype attribute

enctype

The purpose of the HTML enctype attribute is to define the content encoding type for a form.

Supported elements

HTML enctype attribute supports form element.

Syntax

<form enctype="value" >.....</form>

Type of value

Encoding type.

Value

Encoding type.

Default value

There is no default value of HTML enctype attribute.

Supported doctypes

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

Example of HTML enctype attribute with form

<!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>Example of HTML enctype attribute with form</title>
</head>
<body>
<form action="action.php" method="post" enctype="text/plain"> 
First Name : <input type="text" name="Fname"/><br/>
Remarks : <br/><textarea  cols="10" rows="10" /> </textarea><br/>
<button type="button" name="Submit">Submit</button>
</form>
</body>
</html>

Result

html enctype attribute with form

View this example in a separate browser window

Example of HTML enctype attribute with form

Previous: HTML disabled attribute
Next: HTML for attribute