Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android browser - remove outline border when anchor is focused

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 !

like image 331
hsz Avatar asked Sep 13 '11 08:09

hsz


People also ask

How do you remove the focus border?

If you want to remove the focus around a button, you can use the CSS outline property. You need to set the “none” value of the outline property.

How do I remove outline on link click?

Just add a:visited { outline: none; } in your style file.

How do I get rid of the blue border on my focus input?

Answer: Use CSS outline property In Google Chrome browser form controls like <input> , <textarea> and <select> highlighted with blue outline around them on focus. This is the default behavior of chrome, however if you don't like it you can easily remove this by setting their outline property to none .


2 Answers

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.

like image 200
Sajid Avatar answered Oct 10 '22 06:10

Sajid


according to this post it's better to use

a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: none;
}
like image 1
sorrow poetry Avatar answered Oct 10 '22 06:10

sorrow poetry