html中input提示文字样式修改

在很多网站上我们都看到input输入框显示提示文字,让我们一起来看看如果在input输入框中显示提示文字。我们只需要在<input>标签里添加:placeholder="提示文字即可",那么如果要修改提示...

在很多网站上我们都看到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>

修改后提示文字样式如下:

  • 发表于 2020-07-29 23:00
  • 阅读 ( 115 )
  • 分类:网络文章

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除