This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The HTML Command element (
<command>) represents a command which the user can invoke. Commands are often used as part of a context menu or toolbar. However, they can be used anywhere on the page.
<command> element is included in the W3C specification, but not in the WHATWG specification, and browser support is nonexistent. You should use the
<menuitem> element instead, although that element is non-standard and only supported in Edge and Firefox.
|Content categories||Flow content, phrasing content, metadata content.|
|Permitted content||None, it is an empty element.|
|Tag omission||The start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden.|
|Permitted parent elements||
This element includes the global attributes.
- Indicates whether the command is selected. Must be omitted unless the
- Indicates that the command is not available.
- Gives a picture which represents the command.
- The name of the command as shown to the user.
- This attribute gives the name of the group of commands, with a
radio, that will be toggled when the command itself is toggled. This attribute must be omitted unless the
- This attribute indicates the kind of command. This can be one of three values.
commandor empty which is the default state and indicates that this is a normal command.
checkboxindicates that the command can be toggled using a checkbox.
radioindicates that the command can be toggled using a radio button.
<command type="command" label="Save" icon="icons/save.png" onclick="save()">
The definition of '<command>' in that specification.
BCD tables only load in the browser