搜索框设置背景图 通过设置placeholder属性添加

/#keyword/
id名为keyword的input框(搜索框)添加背景图片

#keyword::-webkit-input-placeholder {
    color: transparent;
    text-indent: -9999px;
    background: transparent url(../img/google_custom_search_watermark.gif) no-repeat 10% center;
}
#keyword::-moz-placeholder {
    /* Firefox 19+ */
    color: transparent;
    text-indent: -9999px;
    background: #fff url(../img/google_custom_search_watermark.gif) no-repeat 10% center;
}
#keyword:-moz-placeholder {
    /* Firefox 18- */
    color: transparent;
    text-indent: -9999px;
    background: transparent url(../img/google_custom_search_watermark.gif) no-repeat 10% center;
}
#keyword:-ms-input-placeholder {
    /* IE 10- */
    color: transparent;
    text-indent: -9999px;
    background: transparent url(../img/google_custom_search_watermark.gif) no-repeat 10% center;
}
    原文作者:Linda0821
    原文地址: https://segmentfault.com/a/1190000017937679
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞