- 首先IE9不支持placeholder属性;
- IE10和Edge下的placeholder设置不了颜色和大小;
但是看了小米官网的注册就是可以的,请问如何做到IE9+以上的placeholder兼容性
但是看了小米官网的注册就是可以的,请问如何做到IE9+以上的placeholder兼容性
纯HTML+CSS,貌似比placeholder
属性兼容还好?,虽然还不够完美~
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.input {
width: 169px;
-webkit-appearance: textfield;
background-color: white;
-webkit-rtl-ordering: logical;
cursor: text;
padding: 1px;
border-width: 2px;
border-style: inset;
border-color: initial;
border-image: initial;
text-rendering: auto;
color: rgb(128, 114, 114);
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
text-align: start;
margin: 0em;
font: 400 13.3333px Arial;
}
.input:empty:not(:focus)::before {
content: attr(data-placeholder);
}
</style>
</head>
<body>
<div class="input" contenteditable data-placeholder="请输入文字"></div>
<input type="text" placeholder="请输入文字" />
</body>
</html>
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答5.1k 阅读✓ 已解决
3 回答1.4k 阅读✓ 已解决
用label标签伪造出placeholder,当onfocus时消失即可