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:23

Solution

*:focus {
    outline: 0;
}

PS: Use outline:0 instead of outline:none on focus. It's valid and better practice.

查看更多
谁念西风独自凉
3楼-- · 2018-12-31 05:26

Set

input:focus{
    outline: 0 none;
}

"!important" is just in case. That's not necessary. [And now it's gone. –Ed.]

查看更多
几人难应
4楼-- · 2018-12-31 05:28

The current answer didn't work for me with Bootstrap 3.1.1. Here's what I had to override:

.form-control:focus {
  border-color: inherit;
  -webkit-box-shadow: none;
  box-shadow: none;
}
查看更多
冷夜・残月
5楼-- · 2018-12-31 05:28

This will definitely work. Orange outline will not show anymore.. Common for all tags:

*:focus {
    outline: none;
}

Specific to some tag, ex: input tag

input:focus {
   outline:none;
}
查看更多
路过你的时光
6楼-- · 2018-12-31 05:32
<input style="border:none" >

Worked well for me. Wished to have it fixed in html itself ... :)

查看更多
登录 后发表回答