语法
any-pointer 特性由以下列表中的一个关键字值指定。
注意: 如果可用设备具有不同的特性,则可以匹配多个值,但 none 仅在它们都不是指针设备时才匹配。
示例
此示例为至少具有一个精确指针的用户创建了一个小复选框,为至少具有一个粗略指针的用户创建了一个大复选框。大复选框优先,因为它在小复选框之后声明。
HTML
html
<input id="test" type="checkbox" /> <label for="test">Look at me!</label>
CSS
css
input[type="checkbox"]:checked {
background: gray;
}
@media (any-pointer: fine) {
input[type="checkbox"] {
appearance: none;
width: 15px;
height: 15px;
border: 1px solid blue;
}
}
@media (any-pointer: coarse) {
input[type="checkbox"] {
appearance: none;
width: 30px;
height: 30px;
border: 2px solid red;
}
}
结果
规范
| 规范 |
|---|
| 媒体查询第 4 级 # any-input |
浏览器兼容性
加载中…