How can i add icon in placeholder
15,356
Please check this link JsFiddle
HTML:
<!-- Search, search, search and search! -->
<input type="search" name="search" placeholder="search" rel="search" />
CSS:
input {
background-image: url(https://cdn4.iconfinder.com/data/icons/round-mobile-ui-set/512/letter-message-email-mail-20.png);
background-position: 10px center;
background-repeat: no-repeat;
border: 1px solid #ccc;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
padding: 10px 5px 10px 20px;
text-indent: 20px;
-webkit-transition: all 0.2s;
-moz-transition: all 2s;
transition: all 0.2s;
width: 200px;
}
How to add awesome icon in placeholder, Please check this jsFiddle
Author by
xakar
Updated on December 02, 2022Comments
-
xakar over 1 year
I create a mail form and i want to add an icon in placeholder as like as the picture below. How can i add this?
-
Nitesh Goyal about 7 yearsPossible duplicate of stackoverflow.com/questions/13761654/…
-
Lalji Tadhani about 7 yearsPossible duplicate of Use Font Awesome Icon in Placeholder
-
Thanh Nguyen about 7 yearsPossible duplicate of HTML5 image icon to input placeholder
-
-
xakar about 7 yearsis this only way with backgraound image?