11

As you can see

alt text

I want to somehow remove the dotted lines after the button has been clicked.Any ideas how ?

Thanks

GUYS : This is the current status of my CSS ansd HTML but still no USE:

.myButton input {
position:absolute;
display:block;
top: 5%;
left:87%;
height: 44px;
border:none;
cursor:pointer;
width: 43px;
font: bold 13px sans-serif;;
color:#333;
background: url("hover.png") 0 0 no-repeat;
text-decoration: none;
}
.myButton input:hover {  
background-position: 0 -44px;
color: #049;
outline: 0;
}
.myButton input:active {
background-position: 0 -88px;
color:#fff;
outline: 0;
}

input:active, input:focus {
      outline: 0;
}

<div class="myButton">
<input type="submit" value="">
</div>

Nothing seems to be happening !!

5416339
  • 417
  • 3
  • 9
  • 18

6 Answers6

17

You have to style the <a> like:

a {outline: none}
Linus Kleen
  • 33,871
  • 11
  • 91
  • 99
6

use the below code

a:active
    {
    outline: none;
    }

try for other browsers also

a:focus
{
-moz-outline-style: none;
}
a:focus { outline:none }
kobe
  • 15,671
  • 15
  • 64
  • 91
5

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";
}
Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
3

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.)

Shikiryu
  • 10,180
  • 8
  • 49
  • 75
1

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.

bibaso
  • 11
  • 1
1
    #myElement { outline: 0; }

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

danieelito
  • 51
  • 3
  • This is a very helpful answer. I have a div that I wanted to remove the outline from and this works. Inline, my code looks like this `
    Bar
    ` This is part of some code which display 6 "tile regions" across the page. Each region is clickable and the outline does not appear when the region is clicked.
    – sail0r Nov 17 '15 at 15:26