Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove or disable focus border of browser via javascript

Does anybody know how to disable or manipulate the (in most browsers) dashed border of a dom-element if it has the focus in a tabindex order?

I want to build my own style for a focused element, but it would be great to use the existing feature, because with tabindex it is possible to bind keydown event to the dom-element.

like image 325
helle Avatar asked Jun 10 '10 14:06

helle


People also ask

How do I get rid of focus border?

To remove or disable focus border of browser with CSS, we select the styles for the :focus pseudo-class. to set the outline style to none to remove the border of the element that's in focus.

How do you turn off focus in HTML?

To disable focus on a specific element, set the tabIndex property on the element to a value of -1 . The tabIndex property can be used to specify that an element cannot be focused using keyboard navigation. Here is the HTML for the examples in this article. Copied!


2 Answers

Just make a CSS rule for the elements you want that have outline:none;

like image 50
Gabriele Petrioli Avatar answered Sep 21 '22 21:09

Gabriele Petrioli


CSS trick:

:focus { outline: none; } 
like image 22
goker.cebeci Avatar answered Sep 21 '22 21:09

goker.cebeci