使输入字段透明

时间:2013-06-02 12:16:27

标签: css input background-image transparency input-field

我想采用标准输入字段并使其看起来更好。 因此,我将此图像用作我页面上的输入字段:

enter image description here

要在我的页面上使用它,我使用此代码:

HTML:

<input type="text" class="inputstyle" />

CSS

.inputstyle {
padding:7px 10px 5px 10px;
width:251px;
height: 38px;
background: url('images/form_smaller.png') no-repeat 0 center;
border:0;
font-size:14px;
}

当输入字段在白色背景上时,这不是问题。但是我在浅绿色背景上有输入字段,它使输入字段看起来像这样:

enter image description here

我的问题是:如何删除原始输入字段的边角以使其看起来很棒?

1 个答案:

答案 0 :(得分:0)

要回答您的实际问题,您只需要将图像设为透明的gif或png。 Photoshop可以轻松完成,只需删除背景图层,确保输入有背景,然后使用文件&gt;保存;保存为Web和设备。

但是,我建议不要用背景图像替换输入。一个简单的border-radius将在所有现代浏览器上完成工作。