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?
Asked
Active
Viewed 2.0k times
2
-
1Possible duplicate of http://stackoverflow.com/questions/13761654/html5-image-icon-to-input-placeholder – Nitesh Goyal Mar 10 '17 at 09:56
-
2Possible duplicate of [Use Font Awesome Icon in Placeholder](http://stackoverflow.com/questions/19350291/use-font-awesome-icon-in-placeholder) – Lalji Tadhani Mar 10 '17 at 09:57
-
Possible duplicate of [HTML5 image icon to input placeholder](http://stackoverflow.com/questions/13761654/html5-image-icon-to-input-placeholder) – Thanh Nguyen Mar 10 '17 at 10:08
1 Answers
6
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

gelanivishal
- 288
- 2
- 12