Dofactory.com
Dofactory.com

HTML <iframe> tabindex Attribute

The tabindex attribute on an <inframe> tag specifies the keyboard tab order of the iframe relative to the other controls on the page.

The tabindex value indicates when the frame can be focused.

Example

#

A tabindex attribute on an <iframe> tag.
Place focus on a link inside the frame and tab. Focus will jump to other elements inside the frame.

<iframe src="https://www.wikipedia.org/wiki/Vincent_van_Gogh" 
        style="width:100%;height:450px;" tabindex="5">
</iframe>

Code explanation

The tabindex attribute assigns a tab sequence number to an iframe.

The actual tabindex numbers are not important. So, 30, 22, and 10 would give the same results.


Using tabindex

The tabindex specifies the focus order of the <iframe> relative to the other areas or controls on the page.

This attribute indicates the sequential order of elements using the tab key.

With a negative tabindex value, the iframe is not reachable by tabbing but can be accessed by mouse or JavaScript.

The tabindex attribute is a global attribute that can be applies to any element.

Once an <iframe> has focus, it will continue with the elements inside the frame.


Syntax

<a tabindex="index">

Values

#

Value Description
index Numeric value indicating the tab order relative to the other controls.

Browser support

Here is when tabindex support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <iframe>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


Quick question: what's your favorite/least favorite part of Dofactory?


Guides