如何使此输入透明?
<input type="text" class="foo">
Run Code Online (Sandbox Code Playgroud)
我试过这个,但它不起作用.
background:transparent url(../img/transpSmall.png) repeat scroll 0 0;
Run Code Online (Sandbox Code Playgroud)
小智 132
input[type="text"]
{
background: transparent;
border: none;
}
Run Code Online (Sandbox Code Playgroud)
没有人会知道它在那里.
小智 23
我喜欢这样做
input[type="text"]
{
background: rgba(0, 0, 0, 0);
border: none;
outline: none;
}
Run Code Online (Sandbox Code Playgroud)
设置outline
属性以none
阻止浏览器在光标进入时突出显示该框
前面描述的两种方法今天还不够.我个人使用:
input[type="text"]{
background-color: transparent;
border: 0px;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
width:5px;
color:transparent;
cursor:default;
}
Run Code Online (Sandbox Code Playgroud)
它还删除了某些浏览器上的阴影集,隐藏了可以输入的文本,并使光标的行为就像输入不存在一样.
您可能还想将宽度设置为0px.
如果您想在聚焦时删除轮廓,请尝试:
input[type="text"],
input[type="text"]:focus
{
background: transparent;
border: none;
outline-width: 0;
}
Run Code Online (Sandbox Code Playgroud)