去除文本输入的内阴影

所以我有一个文本输入,即使用 html5,在 chrome,我想改变文本输入的外观,我已经删除了轮廓对焦(橙色对 chrome) ,我设置的背景为浅色 #f1f1f1,但现在有一个更厚的边框在顶部和左侧,就像它的意思是看推进,当没有改变背景颜色这不会发生。我怎么把它取出来?对不起,我不能提供图片,在移动设备上。

它发生在 chrome,也就是 Firefox 上,不能测试其他任何浏览器。

179917 次浏览

Add border: none or border: 0 to remove border at all, or border: 1px solid #ccc to make border thin and flat.

To remove ghost padding in Firefox, you can use ::-moz-focus-inner:

::-moz-focus-inner {
border: 0;
padding: 0;
}

See live demo.

Set border: 1px solid black to make all sides equals and remove any kind of custom border (other than solid). Also, set box-shadow: none to remove any inset shadow applied to it.

border-style:solid; will override the inset style. Which is what you asked.

border:none will remove the border all together.

border-width:1px will set it up to be kind of like before the background change.

border:1px solid #cccccc is more specific and applies all three, width, style and color.

Example: https://jsbin.com/quleh/2/edit?html,output

This is the solution for mobile safari:

  appearance: none;
-moz-appearance: none;
-webkit-appearance: none;

as per https://developer.mozilla.org/en-US/docs/Web/CSS/appearance

and as suggested here: Remove textarea inner shadow on Mobile Safari (iPhone)

None of the solution are working currently. Here is my solution. You can add prefixes.

box-shadow: inset 0px 0px 0px 0px red;

I'm working on firefox. and I was having the same issue, input type text are auto defined something looks like boxshadow inset, but it's not. the you want to change is border... just setting border:0; and you're done.

Try this
outline: none;

live demo https://codepen.io/wenpingguo/pen/KQgbXq

here is a small snippet that might be cool to try out:

input {
border-radius: 10px;
border-color: violet;
border-style: solid;
}

note that: border-style removes the inner shadow.

input {
border-radius: 10px;
border-color: violet;
border-style: solid;
}
<input type="text"/>

All browsers, including Safari (+ mobile):

input[type=text] {
/* Remove */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
    

/* Optional */
border: solid;
box-shadow: none;
/*etc.*/
}