在firefox中修改div onclick轮廓

时间:2009-05-15 15:43:16

标签: firefox

在Firefox中,只要点击链接,项目周围就会出现虚线轮廓。

是否可以修改它以便我可以选择正在突出显示的div,或者自定义它概述的区域?

3 个答案:

答案 0 :(得分:3)

我想你想看看Removing Dotted Links

如果要保留基于标签的导航的虚线边框,请将其应用于a:active。这仍然允许指针在键盘聚焦时出现,但在激活鼠标时隐藏:

a:active
{
    outline: none;
}

对于所有链接:

a
{
    outline: none;
}

仅适用于基于Mozilla的浏览器:

:focus
{
    -moz-outline-style: none;
}

但这只回答了你问题的一半。要更改虚线轮廓概述的区域,您可能必须编写一些JavaScript,以根据链接的单击事件更改要勾勒的元素的边框或轮廓。

答案 1 :(得分:2)

在CSS中:

a:active{outline:0;border:(customize the border around the active link)}

对于div(使用JQuery):

$(function(){ 
    $('div#your-id').click(function(){ 
        $(this).css({'enter the CSS rules for the div here'}); 
    }); 
});

http://docs.jquery.com/CSS/css#name

答案 2 :(得分:1)

Css:

:focus {outline:none;}
::-moz-focus-inner {border:0;}