FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

icons inside input fields

 


riyadh
how do i put an icon inside a text input field for example a search icon inside a search box like theydo in Yahoo! or other websites?
trefen
Try make the icon background (no-repeat) using css. If you don't want to write over the icon, add padding-left to the css.

Eks:

Write over icon:
Code:
<input type="text" style="background:url( icon.jpg ) no-repeat;">


Writing next to the icon (change 25 to the width of your icon):
Code:
<input type="text" style="background:url( icon.jpg ) no-repeat; padding-left:25">


Worked for me Very Happy

Hope it helps! Wink
BlueVD
Now, depending on what you want exactly (custom borders, etc) you can make them using the background tip trefen gave and "border:none;"
alalex
then of course you can position it wherever you want using background-position (right, left, top, bottom) or even combione them however you want:
Code:
<input type="text" style="background:url( icon.jpg ) no-repeat; background-position:left;">
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.