John
John

Reputation: 339

How to disable HTML selection blue background?

That might not be a big deal for someones but i'm struggling with a little issue.

When i click several times on elements in my html, there are some blue selection rectangles that showing up.

I'm trying to find a way to get rid of that.

In my scss, i've tried

input, textarea, select, a, button { @include user-select(none) ; }

But i still get this issue mostly on text element.

So my question is : How to disable HTML blue selection when we make clicks on the links.

Any help will be appreciated.

Thanks.

Upvotes: 0

Views: 4217

Answers (2)

Santosh Khalse
Santosh Khalse

Reputation: 12710

If you are talking about outlines so you can try below code

*{
outline-style: none;
}

or

*{
outline: none;
}

If you are talking about selection so use this code

 user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;

Upvotes: 1

Shobhit Srivastava
Shobhit Srivastava

Reputation: 549

Try this:

::selection {
    background: transparent;
}
::-moz-selection {
    background: transparent;
}

Upvotes: 6

Related Questions