How to remove the “Dotted Border” on clicking?

前端 未结 6 1440
终归单人心
终归单人心 2020-12-11 03:52

As you can see

\"alt

I want to somehow remove the dotted lines after the button has been clicke

相关标签:
6条回答
  • 2020-12-11 04:14

    use the below code

    a:active
        {
        outline: none;
        }
    

    try for other browsers also

    a:focus
    {
    -moz-outline-style: none;
    }
    a:focus { outline:none }
    
    0 讨论(0)
  • 2020-12-11 04:16

    Despite my comment on your question,

    You should keep them for accessibility.

    You can find your CSS-trick here for this

    (Anyway, you should keep them.)

    0 讨论(0)
  • 2020-12-11 04:17

    Possible with pure HTML as well:

    <a href="..." hidefocus="hidefocus">...</a>
    

    And with JavaScript you can do that on all links:

    window.onload = function WindowLoad(evt) {
       //hide focus:
       var arrLinks = document.getElementsByTagName("a");
       for (var i = 0; i < arrLinks.length; i++) {
           arrLinks[i].hideFocus = "true";
    }
    
    0 讨论(0)
  • 2020-12-11 04:27

    You have to style the <a> like:

    a {outline: none}
    
    0 讨论(0)
  • 2020-12-11 04:33

    If you want to keep the outline on active and on focus, but hide it on clicking a link, you can add in css:

    A.No-Outline {outline-style:none;}

    and use script:

    $('A').hover(function() {
        $(this).addClass('No-Outline');
    },function() {
        $(this).removeClass('No-Outline');
    });
    

    you must be hover befor clicking, so it does the job.

    0 讨论(0)
  • 2020-12-11 04:36
        #myElement { outline: 0; }
    

    Try this on your element, i dont now if is an image, div, button, link. But it works

    0 讨论(0)
提交回复
热议问题