HTML accesskey Attribute


Example

Two hyperlinks with specified accesskeys:

<a href="https://www.w3schools.com/html/" accesskey="h">HTML</a><br>
<a href="https://www.w3schools.com/css/" accesskey="c">CSS</a>
Try it Yourself »

Definition and Usage

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

The accesskey attribute value must be a single character (a letter or a digit).

Warning

Using accesskeys is difficult because they may conflict with other key standards in the browser.

To avoid this problem, most browsers will use accesskeys only if pressed together with the Alt key.

Concerns

Adapting accesskeys to all international languages are difficult.

The accesskey value may not be present on all keyboards.

Because of these concerns, it is advised not to use accesskeys.


Browser Support

Attribute
accesskey Yes Yes Yes Yes Yes

Syntax

<element accesskey="character">

Attribute Values

Value Description
character A single character that specifies the shortcut key to activate/focus the element

Related Pages

HTML Tutorial: HTML Attributes

HTML DOM reference: accessKey Property


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.