HTML accesskey Attribute defines the keyboard shortcut key which is used to activate, focus or click the specific HTML element. HTML accesskey Attribute is a Global attribute which is supported by all elements and browsers.
Table of Contents
Syntax of HTML accesskey Attribute
The Syntax of HTML accesskey Attribute is shown below.
<a accesskey="h">HowToCodeSchool</a>
Usage of HTML accesskey Attribute
HTML accesskey Attribute is used to focus or activate HTML element. The keyboard key defined with accesskey attribute is used with another key to focus an element, this key depends on the browser.
Browser | Key Combination |
---|---|
Internet Explorer | [Alt] + accesskey |
Chrome | [Alt] + accesskey |
Firefox | [Alt] + [Shift] + accesskey |
Safari | [Alt] + accesskey |
Opera | [Alt] + accesskey |
Used For
HTML accesskey Attribute is a Global attribute which means it can be used with all HTML Tag.
Tag Name |
---|
Can be used for All HTML Tags |
Example of HTML accesskey Attribute
Simple example of HTML accesskey Attribute is given below.
<a href='https://www.howtocodeschool.com/' accesskey="h">HowToCodeSchool</a>
In above example we have used HTML accesskey Attribute to define the accesskey for anchor tag. The keyboard key h can be used with another keyboard key to click the link.
Values of HTML accesskey Attribute
Any keyboard key which is single printable character can be used as value of HTML accesskey Attribute.
Value | Description |
---|---|
Any Single Printable Character | Represents that key to access the element. |
Browser Support for HTML accesskey Attribute
HTML accesskey Attribute is supported by following major browsers.
Browser Name | Version |
---|---|
Chrome | All |
Firefox | All |
Opera | All |
IE / Edge | All |
Safari | All |