开发者

Can we change the traversal identifier in HTML page from a dotted rectangle to a block?

开发者 https://www.devze.com 2023-03-11 20:19 出处:网络
When we traverse in an HTML page by pressing the tab key , a dotted rectangle appears , by which we can identify the position/element in the page. My question is c开发者_JAVA百科an i make it a block i

When we traverse in an HTML page by pressing the tab key , a dotted rectangle appears , by which we can identify the position/element in the page. My question is c开发者_JAVA百科an i make it a block i.e the selected elements(links , tabs) color and background will change at the time of traverse ?


You can override the browser's default style as described in this MDC article.

Basic example:

:focus {
    background-color: #aaa;
    outline: 1px solid red;
}

Demo: http://jsbin.com/otoco5

The :focus selector works in every browser you could expect, except IE 6 and 7.1,2


You can create a CSS rule using the :focus pseudo-class:

The :focus pseudo-class applies while an element has the focus (accepts keyboard events or other forms of text input).

0

精彩评论

暂无评论...
验证码 换一张
取 消