css焦点不工作在safari和chrome [英] css focus not working in safari and chrome

查看:81
本文介绍了css焦点不工作在safari和chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,我从来没有。请参阅以下代码:

I got one strange problem which I never got before. Please see this code:

css:

#btn{
    margin-left:150px;
    padding:10px;
    display:block;
}
#btn a{
    padding:5px 20px;
    background:green;
    color:#FFF;
    text-decoration:none;
    outline:none;
}
#btn a:hover{
    background:#933;    
}
#btn a:focus, #btn a:active{
    background:#CF0;
color:#000; 

}

p>

Here the HTML

<div id="btn">
   <a href="#">Click here</a>
</div>

焦点活动 in firefox,but in in chrome and safari。

The focus and active css working well in firefox, but not in the chrome and safari.

推荐答案

不是真的是一个错误。在html中轻松修复。只需使用tabindex。

Yeah seems like little problem with focus in webkit. Not really a bug. Easily fixable in html. Just use tabindex.

     <a href="#" class="hide" tabindex="1">[hide]</a>
     <a href="#" class="show" tabindex="2">[show]</a>

ta da ...

ta da ...

这篇关于css焦点不工作在safari和chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆