1

So, I have a box that I want to use as my search box/input box. Although when I type on it, I can type on the whole image.

What I want to do, is to be only able to type in the white space of the image? Would I add padding to it?

This is my CSS:

input.searchbox {
background-color: #fff;
background:url(search.png) no-repeat;
width:250px;
height:41px;
border:none;
font-size:20px;
}

And here is my HTML:

<input type="text" class="searchbox" size="20" value="{Q}">

Also, how would I change the text size within the box?

2 Answers 2

1

your image is a background image. so the text will write over it if necessary.

try putting in a seperate image with some margin between that and the text.

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

3 Comments

So just add an image with maybe the background of the search box, and put the white space image on top of the other image?
without knowing what your image looks like, that sounds about right. a background image, as far as i know, does not interact with other elements. it's like a background color, it won't move out of the way for your text/element
So, dumb question here. How would I add put the input "image" onto the the background image? I'm sorry if that sounds stupid, I'm just not very fluent with CSS as of yet. I would just add the background image like you said, but how do I "line" it up on top of that background image with my input box?
0

depending on your image (text location, what the text is) I used a table to hold the input (with image) and then in a seperate column had the submit button with a matching image next to it.

IMHO it really depends on the image that your using and how you are trying to match it up with the input field.

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.