Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text Form Box HTML Background Image

Tags:

html

css

forms

I have a text form in which the user should enter an email address. I would like this text form to have an image as a background.

Here's what I have so far:

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;
}

I can't get rid of the white background behind the image (it's not the image file, that has rounded corners and no white bits).

Here's what it looks like:

White border

Any suggestions? Thanks.

like image 843
Adam Waite Avatar asked Dec 20 '25 18:12

Adam Waite


2 Answers

Since you are not using a resetting or default style clearing stylesheet you'll need to set the background-color property as well. You can set it to transparent.

like image 140
supakeen Avatar answered Dec 22 '25 10:12

supakeen


Your CSS will be like this:

.emailinput{
    background-image: #000 url(images/desktop/field-normal.png) no-repeat;
    border:none;
    outline:none;
    width:296px;
    height:62px;
}
like image 44
Asif Avatar answered Dec 22 '25 08:12

Asif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!