How to remove border (outline) around text/input b

2018-12-31 04:34发布

This question already has an answer here:

Can anyone explain how to remove the orange or blue border (outline) around text/input boxes? I think it only happens on Chrome to show that the input box is active. Here's the input CSS I'm using:

input {
    background-color: transparent;
    border: 0px solid;
    height: 20px;
    width: 160px;
    color: #CCC;
}

enter image description here

11条回答
春风洒进眼中
2楼-- · 2018-12-31 05:07

I found out that you can also use:

input:focus{
   border: transparent;
}
查看更多
临风纵饮
3楼-- · 2018-12-31 05:10

Please use the following syntax to remove the border of text box and remove the highlighted border of browser style.

input {
    background-color:transparent;
    border: 0px solid;
    height:30px;
    width:260px;
}
input:focus {
    outline:none;
}
查看更多
ら面具成の殇う
4楼-- · 2018-12-31 05:16
input:focus {
    outline:none;
}

This will do. Orange outline won't show up anymore.

查看更多
后来的你喜欢了谁
5楼-- · 2018-12-31 05:16

this remove orange frame in chrome from all and any element no matter what and where is it

*:focus {
    outline: none;
}
查看更多
墨雨无痕
6楼-- · 2018-12-31 05:19

I've found the solution.
I used: outline:none; in the CSS and it seems to have worked. Thanks for the help anyway. :)

查看更多
爱死公子算了
7楼-- · 2018-12-31 05:20

This border is used to show that the element is focused (i.e. you can type in the input or press the button with Enter). You can remove it, though:

textarea:focus, input:focus{
    outline: none;
}

You may want to add some other way for users to know what element has keyboard focus though for usability.

Chrome will also apply highlighting to other elements such as DIV's used as modals. To prevent the highlight on those and all other elements as well, you can do:

*:focus {
    outline: none;
}
查看更多
登录 后发表回答