Textbox with background image using CSS

All we need in order to create an input box like this is an image of a magnifying glass and some CSS code.

This input box is simply created by adding a background image to the the input tag and a left padding so that the text doesn’t overlap the background image.
Download following image:

This is an example of the CSS:

.searchBox{
background-image:url('images/magnifying-glass.gif');
background-repeat:no-repeat;
padding-left:20px;
}

Now, we simply assign our input tag to the CSS class “searchBox”:



Tags: ,

2 Comments

  • Pramod wrote on 19 March, 2010, 14:24

    Hi Please check your code on ie7 and ie8 .. and do input the long text values …

  • zakhona wrote on 8 October, 2011, 14:45

    pls can u help me how to put image dot in the textbox when you use asp.net with capture

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Copyright © 2012 ViralPatel.net. All rights reserved.