html – Safari的iO7 CSS问题与背景大小

前端之家收集整理的这篇文章主要介绍了html – Safari的iO7 CSS问题与背景大小前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
iOS7上的Safari有问题.问题是关于如何在iOS7上的Safari上使用精灵图像以及背景大小(我认为是这样).它在iOS7上的Chrome上运行良好,但Safari没有.正在使用的代码是:
  1. @media only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (-moz-min-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 2dppx) {
  2.  
  3. footer ul.social li a { background-size: 48px 144px; }
  4. footer ul.social li a.fb { background: url(../images/socialx2.png) 0 0 no-repeat; }
  5. footer ul.social li a.in { background: url(../images/socialx2.png) 0 -48px no-repeat; }
  6. footer ul.social li a.tw { background: url(../images/socialx2.png) 0 -96px no-repeat; }
  7.  
  8. }

这是一个在IOS7下的Safari的外观

解决方法

在safari / iOS7上,使用background属性时,background-size将被重置.
您需要在背景后指定background-property:
  1. @media only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min-resolution: 2dppx) {
  2. footer ul.social li a.fb { background: url(../images/socialx2.png) 0 0 no-repeat; background-size: 48px 144px; }
  3. footer ul.social li a.in { background: url(../images/socialx2.png) 0 -48px no-repeat; background-size: 48px 144px; }
  4. footer ul.social li a.tw { background: url(../images/socialx2.png) 0 -96px no-repeat; background-size: 48px 144px; }
  5. }

猜你在找的HTML相关文章