14

I am using on my Android app a webview which loades an external page. It has a few anchors (<a> tags). When I press on it, yellow border appears.

How can I prevent it and remove this border ?

I've tried following tricks:

// jQuery
$("a").focus(function(){
    $(this).attr("hideFocus", "hideFocus");
});

// CSS
a, :focus {
    outline: none;
}

but with no success.

Thanks !

hsz
  • 148,279
  • 62
  • 259
  • 315

2 Answers2

47

Set the CSS property -webkit-tap-highlight-color as follows:

* { -webkit-tap-highlight-color: rgba(0,0,0,0); }

Note: setting the color in other ways usually fails because of the way webkit renders the highlight. Depends on version/variant according to my experience.

Sajid
  • 4,381
  • 20
  • 14
1

according to this post it's better to use

a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: none;
}
sorrow poetry
  • 413
  • 5
  • 11