Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari on iO7 CSS issue with background-size

I have a problem with Safari on iOS7. The problem is about having sprite images for retina so on Safari on iOS7 and background-size (I think so). It works well on Chrome on iOS7, but on Safari doesn't. Code that is in use is:

@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) {

    footer ul.social li a { background-size: 48px 144px; }
    footer ul.social li a.fb { background: url(../images/socialx2.png) 0 0 no-repeat; }
    footer ul.social li a.in { background: url(../images/socialx2.png) 0 -48px no-repeat; }
    footer ul.social li a.tw { background: url(../images/socialx2.png) 0 -96px no-repeat; }

}

Here's an image of how it looks like on Safari under IOS7

screen capture

like image 400
Ayreonaut Avatar asked Sep 20 '13 08:09

Ayreonaut


Video Answer


1 Answers

On safari / iOS7, background-size is reseted when using the background property. You need to specify background-property after your background :

@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) {
    footer ul.social li a.fb { background: url(../images/socialx2.png) 0 0 no-repeat; background-size: 48px 144px; }
    footer ul.social li a.in { background: url(../images/socialx2.png) 0 -48px no-repeat; background-size: 48px 144px; }
    footer ul.social li a.tw { background: url(../images/socialx2.png) 0 -96px no-repeat; background-size: 48px 144px; }
}
like image 79
Jérémie Avatar answered Oct 21 '22 22:10

Jérémie