设置placeholder颜色代码实例

快乐打工仔 分类:实例代码

关于placeholder属性的具体用法可以参阅input placeholder一章节。

下面介绍一下如何设置placeholder的字体颜色,代码实例如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style>
/* WebKit browsers */
::-webkit-input-placeholder { 
  color:green;
}
/* Mozilla Firefox 4 to 18 */
:-moz-placeholder { 
  color:green;
}
/* Mozilla Firefox 19+ */
::-moz-placeholder { 
  color:green;
}
/* Internet Explorer 10+ */
:-ms-input-placeholder { 
  color:green;
}
</style>
</head>
<body>
<input type="text" placeholder="前端教程网"/>
</body>
</html>

回复

我来回复
  • 暂无回复内容