grid - CSS: Cascading Style Sheets 编辑
The grid
CSS media feature can be used to test whether the output device uses a grid-based screen.
Most modern computers and smartphones have bitmap-based screens. Examples of grid-based devices include text-only terminals and basic phones with only one fixed font.
Syntax
The grid
feature is specified as a <mq-boolean>
value (0
or 1
) representing whether or not the ouput device is grid-based.
Examples
HTML
<p class="unknown">I don't know if you're using a grid device. :-(</p>
<p class="bitmap">You are using a bitmap device.</p>
<p class="grid">You are using a grid device! Neato!</p>
CSS
:not(.unknown) {
color: lightgray;
}
@media (grid: 0) {
.unknown {
color: lightgray;
}
.bitmap {
color: red;
text-transform: uppercase;
}
}
@media (grid: 1) {
.unknown {
color: lightgray;
}
.grid {
color: black;
text-transform: uppercase;
}
}
Result
Specifications
Specification | Status | Comment |
---|---|---|
Media Queries Level 4 The definition of 'grid' in that specification. | Candidate Recommendation | No change. |
Media Queries The definition of 'grid' in that specification. | Recommendation | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论