简体   繁体   中英

How can i add icon in placeholder

我怎么能添加这个

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM