搜索框设置背景图 通过设置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;
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理