ISSUE :
 
Profile photo
Submitted by G-Stone
on May 18th, 2011 at 17:46:31 EST

Image icon inside html textbox

I am trying to add image icon to my html textbox. I see lot of website using image icon inside textbox. like search engines use magnifying glass inside textbox. Is there any way to achieve this?


Profile photo
Replied by SBajra
on May 18th, 2011 at 18:13:00 EST
you can achieve this using CSS. You can apply following style sheet to your text box.

.textBox
{
background-image:url(iconimage.jpg);
background-position:left;
background-repeat:no-repeat;
padding-left:17px;
}


Then apply this style to your text box:
<input type="text" class="textBox" />

Hope this helps.
Accepted Answer
Accepted
 Answer

Profile photo
Replied by G-Stone
on May 18th, 2011 at 18:19:51 EST
This works. This is exactly what I am looking for. Thanks.

Profile photo
Replied by Sujatha Burigen
on September 29th, 2013 at 21:25:05 EST
i am unable to use this code to insert an image in the text box. how do i insert an image in the text box using html?