CSS background-position not working in Mobile Safari (iPhone/iPad)

后端 未结 5 1661
面向向阳花
面向向阳花 2020-12-06 00:43

I have an issue with background-position in mobile safari. It works fine on other desktop browsers, but not on iPhone or iPad.

body {
 background-color: #000         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 01:10

    The iPhone/Webkit browser cannot center align background images when placed in the body tag. The only way around this is to remove the background image from your body tag and use an additional DIV as a wrapper.

    #wrapper {
     background-color: #000000;
     background-image: url('images/background_top.png');
     background-repeat: no-repeat;
     background-position: center top;
     overflow: auto;
    }
    
    
    
     
      Title
      
     
     
      

提交回复
热议问题