使文本输入框透明?应该简单吗?

Hou*_*Guy 7 html css forms

我正在尝试使我的表单输入透明,并将其放在我的div之上.基本上我希望文本字段对其背后的任何内容都是透明的.有什么建议?

<head>

<style type="text/css">
  .WRAPPER {
    background-color: #000;
    height: 575px;
    width: 975px;
    background-image: url(exit-gate/exit-gate-bg.png);
    top: auto;
    margin: -8px;
  }

  body {
    background-color: #000;
  } 
</style>

<style type="text/css">
  term {
    background: transparent;
    border: none;
  }
</style>

</head>



<body>
  <div id="WRAPPER"> 
    <div class="term"><input name="email" type="text" id="email">
      <form name="form1" method="post" action="insert_ac.php">
        <input type="image" src="exit-gate/white-box-10.png" alt="{alternate text}" name="submit" value="submit">
      </form>
    </div>
  </div>
</body>
</html>
</div>
Run Code Online (Sandbox Code Playgroud)

Hir*_*ral 12

尝试:

#email {
    background-color:rgba(0, 0, 0, 0);
    color:white;
    border: none;
    outline:none;
    height:30px;
    transition:height 1s;
    -webkit-transition:height 1s;
}
#email:focus {
    height:50px;
    font-size:16px;
}
Run Code Online (Sandbox Code Playgroud)

DEMO在这里.

  • 我会在`rgba`值上使用`transparent`.旧版浏览器默认为纯色.在这种情况下,黑色. (2认同)

小智 5

这看起来太简单了,但它对我有用:

 <input type="text" id="SI"/>
Run Code Online (Sandbox Code Playgroud)

这是我的输入字段,我给了它一个 ID(SI),然后在我的 CSS 中:

#SI{
    background-color:transparent;
}
Run Code Online (Sandbox Code Playgroud)

为具有 SI id 的元素添加透明度;背景变得可见。