Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I click on my HTML button, a blue "selection" border is displayed [duplicate]

Tags:

html

css

button

I created this HTML button, and after styling it with CSS, every time it's clicked a blue selection border appears around it. Is there any way to fix this? I know that the default unchanged element does not do this when i create it, so I'm thinking it must have something to do with the CSS I added.

HTML:

<button type="button" class="drop-button" >-</button>

CSS:

.drop-button {
    background-color: #343436;
    color: #FFFFFF;
    border: none;
    border-radius: 5px;
    margin-right: 8px;
    margin-left: 4px;
    height: 20px;
    width: 25px;
    font-size: 20px;
    vertical-align: middle;
    line-height: 0px;
}

Here is a link to it. http://jsfiddle.net/xytxnpyt/

like image 221
James Boehme Avatar asked Jul 21 '16 16:07

James Boehme


People also ask

How do I get rid of the blue border around a button in CSS?

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 hide the outline of a button?

So use border: none; and that annoying blue border shall disappear!


3 Answers

This is the default behavior of Chrome. You can turn it off with this...

button:focus{
outline: none;
}
like image 83
Miles Avatar answered Oct 09 '22 05:10

Miles


Here you go:

.drop-button:focus {
    outline: 0;
}

Fiddle

like image 22
dodopok Avatar answered Oct 09 '22 03:10

dodopok


Although I could not reproduce the blue selection border you are talking about in JSFiddle, try adding "outline-width:0px;" to the button's CSS and see if that does anything

like image 30
user3163495 Avatar answered Oct 09 '22 04:10

user3163495