HTML Attributes

HTML accesskey Attribute

The accesskey attribute assigns a keyboard shortcut that a user can press to activate or focus an element.


The accesskey Attribute

accesskey is a global attribute, meaning it can be applied to any HTML element, though it is most useful on interactive elements such as links, buttons and form fields. It defines one or more single characters that, combined with a browser-specific modifier, act as a keyboard shortcut to focus or click the element.

Syntax

ℹ️

Syntax: <element accesskey="s">. The value is a space-separated list of single characters; the browser uses the first one it supports.

A save button with a keyboard shortcut
<button accesskey="s">Save</button>
<a href="/help" accesskey="h">Help</a>

The modifier key needed to trigger an accesskey differs by browser and operating system. Common combinations are Alt on Windows, Alt+Shift in Firefox, and Control+Option in Safari on macOS.

ValueDescription
sA single character used as the shortcut key
s hSpace-separated list; the browser picks the first supported character
⚠️

Use accesskey sparingly. Chosen keys often clash with browser, operating-system or assistive-technology shortcuts, which can harm accessibility rather than help it.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships