I have a submit button with the background color of green. When clicking on it, it changes the background color to red, but after clicking it, the background color changes back to green, and there is a blue border surrounding the button. I'm wondering if there is a way to get rid of the blue borders? Thank you.
我有一个提交按钮,背景颜色为绿色。单击它时,它会将背景颜色更改为红色,但单击它后,背景颜色会变回绿色,按钮周围会出现蓝色边框。我想知道是否有办法摆脱蓝色边界?谢谢。
input[type=submit] {
background-color: green;
}
input[type=submit]:active {
background-color: red;
}
<input type = 'submit' value = 'Click me'>
2 个解决方案
#1
2
Set outline
to 0
and add :focus
to the button, which means after it has been clicked and remains in focus.
将轮廓设置为0并添加:焦点到按钮,这意味着在单击它并保持焦点后。
input[type=submit]:focus {
background-color: green;
outline: 0;
}
#2
0
Want do you want to do with the button, should he be green or red after click? Remove the border( if the elem has one ) and the outline....should do the trick.
http://www.w3schools.com/css/css_link.asp
想要用按钮做什么,点击后是绿色还是红色?删除边框(如果元素有一个)和轮廓....应该做的伎俩。 http://www.w3schools.com/css/css_link.asp
input[type=submit]:active{
background-color: green;
outline: 0;
border: none;
}
#1
2
Set outline
to 0
and add :focus
to the button, which means after it has been clicked and remains in focus.
将轮廓设置为0并添加:焦点到按钮,这意味着在单击它并保持焦点后。
input[type=submit]:focus {
background-color: green;
outline: 0;
}
#2
0
Want do you want to do with the button, should he be green or red after click? Remove the border( if the elem has one ) and the outline....should do the trick.
http://www.w3schools.com/css/css_link.asp
想要用按钮做什么,点击后是绿色还是红色?删除边框(如果元素有一个)和轮廓....应该做的伎俩。 http://www.w3schools.com/css/css_link.asp
input[type=submit]:active{
background-color: green;
outline: 0;
border: none;
}