有没有办法允许用户使用“在页面中查找”浏览器功能搜索占位符文本?
我知道我可以添加包含占位符文本的零高度元素,但这似乎是一个 hacky 解决方案。也许使用 CSS 伪类的东西?
编辑:我应该提一下,到目前为止,这只是 Chrome for iOS(10.0.2) 上的一个问题
代码很简单:
<input type="text" placeholder="First Name">
这就是我搜索“第一”时得到的结果
有没有办法允许用户使用“在页面中查找”浏览器功能搜索占位符文本?
我知道我可以添加包含占位符文本的零高度元素,但这似乎是一个 hacky 解决方案。也许使用 CSS 伪类的东西?
编辑:我应该提一下,到目前为止,这只是 Chrome for iOS(10.0.2) 上的一个问题
代码很简单:
<input type="text" placeholder="First Name">
这就是我搜索“第一”时得到的结果
input {
font-size: 1.5rem;
margin: 10px;
padding: 10px;
width: 65%;
}
input:placeholder-shown {
border: 5px solid red;
}
<form>
<input type="text" placeholder="Placeholder text" value="Currently has a value (not showing placeholder).">
<input type="text" placeholder="Currently has no value (showing placeholder).">
</form>