分享

placeholder +html5

 菁清siso 2014-06-19

<input type="text"  id="srss-text"placeholder="标题"value=""/>中在placeholder写入默认值,value值就是空。源:<http://hi.baidu.com/blog20110521/item/c73b212773feb8dfa5275a22>

在html5中input,textarea等元素新添加了placeholder的属性,我们可以通过css设置placeholder的样式,对于ie,firefox,以及webkit内核的浏览器需要使用不同的样式写法。

如下测试代码:

<!doctype html>
<html>
<head>
<style type="text/css">
#myInput::-webkit-input-placeholder {
  color: red;
}
#myInput:-moz-placeholder {
  color: red;
}
#myInput:-ms-input-placeholder {
  color: red;
}?
</style>
</head>
<body>

<input    id='myInput' placeholder='hello'/> <br>
<textarea id='myInput' placeholder='hello'></textarea>?

</body>
</html>


-webkit-tap-highlight-color:rgba(0,0,0,0);/*去除点击时的灰色块*/

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多