tags:

views:

168

answers:

4

I'm trying to position a small little search box form using CSS with a negative top value but when I do this you can no longer click in the text input box or click the button. You can still tab to the form and functionality still works. I've tried positioning the form itself, putting the form in a div and positioning that, positioning a div inside the form and none seem to work.

Is there any way I can move this bit of HTML up about 50px without breaking it?

<form action="search.html" method="post">
<div class="searchBox" id="generalSearch">
<input type="submit" class="fbutton" style="font-size:12px;" value="" />
<input type="text" style="tsearch" name="searchString" maxlength="200" size="24" value="" />
</div>
</form>
A: 

Some other element on the page is interfering with your searchbox due to where it is positioned; not simply because you have a negative top value in CSS.

You can move the searchbox up 50px by reducing the top value by another 50px.

To remedy the interference, try lowering the other elements on the page by adding 50px to their top values.

leadingzero
+2  A: 

set the CSS z-index a bit higher (like form#myForm {z-index:10;}). It's going under the element above.

SpliFF
Yup, I've run in to this issue myself a number of times.
Nicholas Flynt
Yeah, this is the issue. I realized that because of the layout of the site it's being overlapped by the element above it but it will be tricky to fix this because I have two divs that are siblings and the first must overlap the second. The search box is a child of the second div but must now overlap the first. I'm not sure if there's an easy way to do this. Here's a simple sketch of the site: http://kimag.es/share/29821158.gif
p5ycho_p3nguin
A: 

Is your problem in IE or all browsers? If it's in IE only, try setting position:relative on the form (or other hasLayout trigger).

Also beware of z-index issues as SpliFF says.

edeverett
A: 

Ah, the z-index. Truly powerful, but so misunderstood. Take a look and the W3 tutorials on z-index, that should help you with this issue.

Ares download