简体   繁体   English

如何在占位符中添加图标

[英]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 请检查此链接JsFiddle

HTML: HTML:

<!-- Search, search, search and search! -->
<input type="search" name="search" placeholder="search" rel="search" />

CSS: 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 如何在占位符中添加真棒图标,请检查此jsFiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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