html中input提醒笔墨样式修改的示例代码
在许多网站上我们都看到input输入框表现提醒笔墨,让我们一路来看看假如在input输入框中表现提醒笔墨。我们只必要在<input>标签里添加:placeholder="提醒笔墨即可",那么假如要修改提醒笔墨的样式呢?可以这样配置css样式: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>input输入框提醒笔墨</title> <style> /*修改提醒笔墨的颜色*/ input::-webkit-input-placeholder { /* WebKit browsers */ color: red; } input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: red; } input::-moz-placeholder { /* Mozilla Firefox 19+ */ color: red; } input:-ms-input-placeholder { /* Internet Explorer 10+ */ color: red; } </style> </head> <body> <input type="text" placeholder="请输入用户名" /> </body> </html> 修改后提醒笔墨样式如下: PS:下面看下HTML5里的input标签的required属性提醒笔墨修改 在做表单提交时我们偶然会碰着这样的需求,在用户没有输入必填信息点提交时提醒笔墨必要改为我们想要的提醒信息,那么可以在input内里增进这样的语句: <input type="text" placeholder="您的姓名" required oninvalid="setCustomValidity('请输入您的姓名');" oninput="setCustomValidity('');" /> 到此这篇关于html中input提醒笔墨样式修改的文章就先容到这了,更多相干html input 笔墨样式内容请搜刮剧本之家早年的文章或继承赏识下面的相干文章,但愿各人往后多多支持剧本之家! (编辑:河北网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |