CSS remove default blue border

2019-02-02 21:56发布

I have a form with multiple buttons where I use a JavaScript to submit the second button when some one presses enter.

This works great but if I open this form in IE the first button gets a blue border that tells the user "this is the button that will be pressed when you press enter".

Is there any way to remove that with CSS without overriding the rest of the button's styling?

default button style

Example:

<button  onclick="javascript:alert('remove');">Remove name</button>

8条回答
女痞
2楼-- · 2019-02-02 22:28
#sideToggle:focus, #sideToggle:active{
  outline: 0;     
  outline-style:none;     
  outline-width:0;
}

This solved my problem if anyone else visits the post. I added my own styles separately, as they really aren't central to the issue.

查看更多
来,给爷笑一个
3楼-- · 2019-02-02 22:29

my solution (after a few months)

button:focus {
outline: 0;
box-shadow: none;
}
查看更多
登录 后发表回答