搜尋框設定背景圖 通過設定placeholder屬性新增

Linda0821發表於2019-02-16

/#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;
}

相關文章