HTML accesskeyAttribute
Examples
A hyperlink with a specified shortcut key:
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the accesskey attribute
Definition and Usage
The accesskey attribute specifies a shortcut key for activating (giving focus to) an element.
Note:The way to access the shortcut key differs in different browsers on different operating systems:
| Browser | Windows | Linux | Mac |
|---|---|---|---|
| Internet Explorer | [Alt] + accesskey | N/A | |
| Chrome | [Alt] + accesskey | [Alt] + accesskey | [Control] [Alt] + accesskey |
| Firefox | [Alt] [Shift] + accesskey | [Alt] [Shift] + accesskey | [Control] [Alt] + accesskey |
| Safari | [Alt] + accesskey | N/A | [Control] [Alt] + accesskey |
| Opera | Opera 15 or newer: [Alt] + accesskey Opera 12.1 or older: [Shift] [Esc] + accesskey |
||
However, in most browsers, the shortcut key can be set to another combination.
Tip:How to use the accesskey shortcut key in various browsers:
IE browser
Press and hold the Alt key, press the access key defined by accesskey (focus moves to the link), then press Enter.
Firefox browser
Press and hold Alt+Shift, then press the access key defined by accesskey.
Chrome browser
Press and hold Alt, then press the access key defined by accesskey.
Opera browser
Press and hold Shift, press Esc, and a list of accesskey shortcut keys defined on this page appears for selection.
Safari browser
Press and hold Alt, then press the access key defined by accesskey.
Differences between HTML 4.01 and HTML5
In HTML5, the accesskey attribute can be used on any HTML element (it will validate any HTML element, but it may not necessarily be useful).
In HTML 4.01, the accesskey attribute can be used on: <a>, <area>, <button>, <input>, <label>, <legend>, and <textarea>.
Syntax
Attribute Values
| Value | Description |
|---|---|
| character | Specifies the shortcut key for activating the element |
HTML Global Attributes Other Extensions