透明文本字段但文本值显示?

时间:2014-03-18 22:37:18

标签: html css textfield

我怎样才能在文本字段中拥有透明背景,但我希望文本内的文字=""显示?是可能的

这是我的代码 HTML

<input type="text" name="firstname" required class="form-control" maxlength="150" value="first name">

CSS

input[type="text"]{
    background: transparent;
    border: 0px;
    outline: none;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    color:black;
}

请帮助

2 个答案:

答案 0 :(得分:0)

我有一个类似的问题,但您可以通过单独的空白部门解决它并使用它来放置文本。如果您不想这样做,可以创建一个半透明的png图像作为背景。

链接到相同的问题 How do I give text or an image a transparent background using CSS?

答案 1 :(得分:0)

试试这个:

input {
background-color: rgba(0,0,0,0.01);
border: none;
}

等参数。带有最后一个参数0.01的rgba()将使您的iput完全透明,border:none将删除默认边框