HTML accesskey
Attribute
Example
Hyperlink with a specified shortcut key:
<a href="//www.tutorialpro.org/html/html-tutorial.html" accesskey="h">HTML Tutorial</a><br>
<a href="//www.tutorialpro.org/css/css-tutorial.html" accesskey="c">CSS Tutorial</a>
Browser Support
All major browsers support the accesskey
attribute.
Definition and Usage
The accesskey
attribute specifies a shortcut key to activate/focus an element.
Note: The way to access the shortcut key varies between different operating systems and browsers:
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] + accesskeyOpera 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
Hold down the Alt key, click the accesskey defined shortcut key (the focus will move to the link), then press Enter.
FireFox Browser
Hold down the Alt+Shift keys, click the accesskey defined shortcut key.
Chrome Browser
Hold down the Alt key, click the accesskey defined shortcut key.
Opera Browser
Hold down the Shift key, click Esc, and a list of accesskey shortcuts defined on the page will appear for selection.
Safari Browser
Hold down the Alt key, click the accesskey defined shortcut key.
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 may not be useful).
In HTML 4.01, the accesskey
attribute can be used with: <a>
, <area>
, <button>
, <input>
, <label>
, <legend>
, and <textarea>
.
Syntax
Attribute Values
Value | Description |
---|---|
character | Specifies the shortcut key to activate/focus the element |