I’m developing a Search Application where the requirement is to have a magnifier image instead of button on the search textbox.
On a maximized page the anchor seems to be on correct place.

But on browser resize (clicking restore down button next to close button) the search textbox looks like this:

Following is my CSS code (I’m not a CSS guy btw :))
.search_div A
{
background: url("search-white.png") no-repeat scroll 4px 4px #FFFFFF;
border: 1px solid #CCCCCC;
height: 11px;
left: 85.8%;
margin-right: 175px;
padding: 6px 5px 4px 20px;
position: fixed;
top: 32px;
width: 0;
}
Please suggest.
You don’t show the full markup for you search button/input so it’s difficult to know exactly how how you exactly position the search button.
Here how I would do it. Let’s say you have the followin markup:
For the wrapping DIV, the key is to explicitly position it relative:
For the search button, make it absolute with a
leftvalue equal zero so it sticks to the left side.As the anchor is absolute positioned, the input will be underneath. The trick is to pad the left side of the input to a value a bit higher than the anchor width, so the beginning of the text is not hidden underneath the anchor:
DEMO
You can go further with this technique then by having the possibility through css to show the search icon to the left or to the right by applying an additionnal class to the
.search_divcontainer.Stick left or right the search icon:
Adjust the padding of the input also left or right:
DEMO