笔记本电脑屏幕注册为最大宽度:320px和方向:纵向

时间:2013-07-09 01:28:01

标签: css3 windows-8 media-queries landscape-portrait

在具有笔记本电脑和视网膜MacBook的高清Windows 8 IE上进行测试。没人有这个问题?似乎最后将max-width: 320px放在那里应该可以防止它,因为很明显这些屏幕超过320px。

@media screen, handheld,  
(min-moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(orientation: portrait),
(max-width: 320px)

该网站为here

1 个答案:

答案 0 :(得分:0)

使用(min/max-)resolution作为(min/max-])device-pixel-ratio的等价物来支持IE:

@media (min-resolution: 1.5dppx), (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2) {}

或通过matchMedia:

if (window.matchMedia) 
  {
  if (window.matchMedia('(resolution: 96dpi)').matches) { }
  // resolution feature & dppx unit
  if (window.matchMedia('(min-resolution: 1dppx)').matches) { }
  // -webkit-device-pixel-ratio feature
  if (window.matchMedia('(-webkit-min-device-pixel-ratio: 1)').matches) { }
  // -o-device-pixel-ratio feature
  if (window.matchMedia('(-o-min-device-pixel-ratio: 1/1)').matches) { }
  }

<强>参考