HTML accesskey attribute

Definition and Usage

accesskey The attribute specifies the shortcut key to activate/focus an element.

accesskey The value of the attribute must be a single character (a letter or a number).

Warning

Using shortcut keys may encounter difficulties as they may conflict with other shortcut keys in the browser.

To avoid this problem, most browsers will only use shortcut keys when pressed together with the Alt key.

Concerns

It is difficult to make shortcut keys adapt to all international languages.

accesskey The value may not exist on all keyboards.

Due to these concerns, it is recommended not to use shortcut keys.

See also:

HTML Tutorial:HTML attributes

HTML DOM Reference Manual:accessKey attribute

Example

Two hyperlinks with specified shortcut keys:

<a href="https://www.codew3c.com/html/" accesskey="h">HTML</a><br>
<a href="https://www.codew3c.com/css/" accesskey="c">CSS</a>

Try It Yourself

Syntax

<element accesskey="character">

Attribute Value

Value Description
character A single character that specifies the shortcut key for the activated/focused element.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support