How do i remove the blue outline from a radio box when focused?
Asked Answered
S

6

7

I would like to remove the blue outline it gives me when my radio is clicked/focused. I tried using outline: none and border: none, but nothing seems to be working. Does anyone have a solution for this?

Screenshot of what I’m talking about:

Image

Stackhouse answered 13/4, 2016 at 17:51 Comment(4)
Where do you see a blue outline? Are you talking about Google Chrome?Lovable
Yes, in google Chrome, whenever i click on the radio checkbox it gives me a square blue outline around it, and i want to get rid of it!Stackhouse
Possible duplicate: #20593724Derision
Can you show us your CSS and the HTML you are referencing it in? The flagged duplicate has outline: none as a solution, which you already state you've tried.Cerotype
C
9

Remove the outline when the input element has the focus.

input:focus{
  outline:none;
}

As a side note, this is only for Google Chrome, other browsers use different techniques for showing an input element has the focus.

Crypto answered 13/4, 2016 at 17:53 Comment(4)
Thank you for your awnser, I tried this already, and it doesn't work somehow.Stackhouse
@Stackhouse please create a basic demo so we could inspect it. you can create one on jsFiddleLovable
Provided a screenshot, i'm pretty sure you guys know what i mean now.Stackhouse
We know what you meant before this, but we need code if the listed solution doesn't work.Crypto
P
7

UPDATE:

Having worked a lot with accessibility lately, I've come to understand that removing the outline from inputs is not a very good thing. It prevents people using keyboard navigation to see what's focused.


ORG POST:

You might have to be more specific with your selector. When using bootstrap you have to override it (in my version, 3.3.6 at least) by selecting input[type="radio"]:focus, not just input:focus, like this:

input[type="radio"]:focus {
    outline: none;
}
Planoconvex answered 22/8, 2016 at 13:23 Comment(0)
P
7

Maybe a separate issue, but I had to set box-shadow to none as well.

input[type="checkbox"] {
    outline: none;
    box-shadow: none;
}
Persona answered 26/10, 2018 at 1:10 Comment(1)
thanks , adding box-shadow: none; solves the issueInositol
Q
1

I know this is old, but hope that it helps somebody!

input[type='radio']:focus {
    outline: none !important;
    box-shadow: none !important;
}
/*For Bootstrap*/
.custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: none !important;
}
Quasijudicial answered 11/2, 2021 at 12:12 Comment(0)
V
1

Try This

input[type="radio"]:focus {
    outline: none;
    box-shadow: none; 
}
Verger answered 28/4, 2022 at 8:38 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Gillum
L
0

Try this:

input[type=radio] {
    outline-color: transparent; 
}

Hope it helps!

Lahomalahore answered 13/4, 2016 at 18:50 Comment(1)
box-shadow: noneGamekeeper

© 2022 - 2024 — McMap. All rights reserved.