目录

如何操作 - 典型设备断点


了解如何对常见设备断点使用媒体查询。


典型设备断点

有大量具有不同高度和宽度的屏幕和设备,因此很难为每个设备创建精确的断点。为了简单起见,您可以针对五个常见群体:

示例

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}
亲自试一试 »

相关页面

CSS 教程:CSS 媒体查询

CSS 教程:CSS 媒体查询示例

CSS 参考:@media 规则

后轮驱动教程:带有媒体查询的响应式网页设计

JavaScript 教程:window.matchMedia() 方法