If you find this helpful, please click the Google |


The <keygen/> Tag in HTML 5
The <keygen> tag is one of the tags for interactive content in HTML.
<keygen/> Tag Syntax
<body> ... ... flow content expected ... <form id="form-id" method="GET|POST|etc." action="target-URL"> ... phrasing content expected ...<keygen/>... ... </form> ... ... phrasing content expected ...<keygen form="form-id"/>... ... </body>
Rules for coding HTML keygen elements
Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.
- Code the keygen element where phrasing content is expected, usually inside a form element.
- Begin the keygen element with a starting <keygen> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the
xmlns
attribute on the <html> tag. - If the field is for a form that can be submitted but is outside that form element, include a
form
attribute referencing the form the keygen is to be associated with. - Include any other attributes on the <keygen> tag as appropriate.
- Inside the keygen element, between the starting
<keygen>
tag and the ending</keygen>
tag, code the inner HTML phrasing content. - End the keygen element with a matching
</keygen>
closing tag.
<keygen/> Content Model
Contents of the keygen element
Content: Empty. All properties are coded using attributes.
Since the <keygen/>
tag is a void element, it is not allowed to have any content, even HTML comments and therefore should always be coded as a self-closing standalone tag, ending with the delimiters />
rather than just >
(<keygen .../>
).
<keygen/> Tag Attributes
Attributes of the <keygen/> tag
global attributes | In addition to the personal attributes of the <keygen/> tag below, any of the common HTML attributes can also be coded. |
autofocus="autofocus" |
|
challenge |
|
disabled="disabled" |
|
form |
|
keytype="rsa" |
|
name |
<keygen/> Tag Examples
Examples of the <keygen/> tag in HTML 5
Changes in HTML 5 - <keygen/> Tag
What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML
The <keygen/> tag did not exist in older versions of HTML.
The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the names of all HTML element types, which now includes the keygen element name. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.