【问题标题】:Text Form Box HTML Background Image文本表单框 HTML 背景图像
【发布时间】:2012-02-23 22:20:14
【问题描述】:

我有一个文本表单,用户应在其中输入电子邮件地址。我希望这个文本表单有一张图片作为背景。

这是我目前所拥有的:

HTML:

<form action="addemailtodatabase.php" method="post">
<input class="emailinput" type="text" name="email" maxlength="80"/>
<input type="submit" name="submit" value="Sign Up"/>
<input type="hidden" name="submitted" value="TRUE"/>
</form>

CSS:

.emailinput{
    background-image:url(images/desktop/field-normal.png);
    background-repeat:no-repeat;
    border:none;
    width:296px;
    height:62px;
}

我无法摆脱图像背后的白色背景(不是图像文件,它有圆角且没有白色位)。

它是这样的:

有什么建议吗?谢谢。

【问题讨论】:

  • 也许是background-color: transparent

标签: html css forms


【解决方案1】:

由于您没有使用重置或默认样式清除样式表,因此您还需要设置background-color 属性。您可以将其设置为transparent

【讨论】:

  • 非常感谢,当您知道时很容易,不是吗!?我会尽快标记为正确。
【解决方案2】:

您的 CSS 将如下所示:

.emailinput{
    background-image: #000 url(images/desktop/field-normal.png) no-repeat;
    border:none;
    outline:none;
    width:296px;
    height:62px;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-21
    • 2012-12-11
    • 1970-01-01
    • 1970-01-01
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    • 2012-03-21
    相关资源
    最近更新 更多