1

I am trying to make an input form have a background image, but as soon as I apply the CSS class to the input, the default value does not show up (it does work if there is no CSS class applied). Here is the HTML:

<form>
     <input type="text" class="emailInput" value="Enter your email address">
     <input type="submit" class="emailBtn" value="">
</form>

And here is the CSS that is associated with it:

input.emailInput {
color:#000;
background:url('images/emailBackground.png') no-repeat;
display:block;
width:313px;
height:31px;
text-indent:-5000px;
position:relative;
top:0px;
left:-2px;
border:none;
}
input.emailBtn {
background:url('images/emailBtn.png') no-repeat;
display:block;
width:55px;
height:38px;
text-indent:-5000px;
position:relative;
top:-32px;
left:323px;
border:none;
}

I am at a total loss. Any help would be greatly appreciated.

2 Answers 2

3

Perhaps the text-indent:-5000px; is causing your text to be positioned out of the visible area.

Sign up to request clarification or add additional context in comments.

2 Comments

Further to this, use IE dev tools or Firebug in Firefox to inspect the CSS. You can then remove the indent to see if this is causing the problem.
Thanks, This is exactly the problem. I looked at this at least 20 times and totally overlooked it every time. I had just pasted from another element where I had the text-indent:-5000px;. I will sheepishly walk away. Thanks for your help!
0

This is just as hunch, but I'm pretty sure your problem is text-indent:-5000px;. Considering your text input elements are much smaller in width than the value set there.

Also, just as a point of note:

http://luigimontanez.com/2010/stop-using-text-indent-css-trick/

So you don't want to use that anyway if you want your page to play nice with Google.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.