我认为这些是最好的断点:
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
编辑:对于960网格进行了优化:
@media (min-width:320px) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:481px) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:641px) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:961px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
实际上,许多设计师将像素转换为em
,主要是因为em
更容易缩放。在标准缩放下,1em === 16px
,将像素乘以1em/16px
即可得到em
。例如,320px === 20em
。
针对这个评论,min-width
在“移动优先”的设计中是标准的,你可以从最小屏幕开始设计,然后逐步添加越来越大的媒体查询,扩展到更大的屏幕。
无论你偏好使用 min-
、max-
还是两者结合,都要注意你的规则顺序,如果有多条规则匹配同一个元素,则后面的规则会覆盖之前的规则。