<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);/*去除点击时的灰色块*/
|
|