HTML的占位符属性在IE10中不能正常工作

Placeholder property of HTML not working properly in IE10

本文关键字:常工作 工作 不能 占位符 属性 IE10 HTML      更新时间:2023-09-26

请考虑以下代码

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
     <input type="text" name="fname" placeholder="First name"><br>
</body>
</html>

这在Chrome和Firefox中工作得很好。但在IE 10中,占位符文本以斜体显示。我想在IE10中正常字体样式的占位符文本。

在IE中,您可以为占位符设置如下样式:

input:-ms-input-placeholder {
    font-style:normal
}