2015-09-02 76 views
0

我正在嘗試爲我的客戶端創建一個響應站點,但他們抱怨用戶可以縮小並在屏幕邊緣看到空白區域。它發生在iPhone 6上,但我只有一臺Galaxy S5才能在所有瀏覽器上進行調試,並且在那裏發生。在移動網頁縮小時出現額外空間Galaxy S5

我的HTML視元的樣子

<meta name="viewport" content="width=device-width, initial-scale=1.0"/> 

我的CSS查詢看起來像

@-webkit-viewport{ 
     width:device-width; 
     zoom: 1.0; 
    } 
    @-moz-viewport{ 
     width:device-width; 
     zoom: 1.0; 
    } 
    @-ms-viewport{ 
     width:device-width; 
     zoom: 1.0; 
    } 
    @-o-viewport{ 
     width:device-width; 
     zoom: 1.0; 
    } 
    @viewport{ 
     width:device-width; 
     zoom: 1.0; 
    } 



@media screen and (max-width: 768px), 
    only screen and (-Webkit-min-device-pixel-ratio: 1.5), 
    only screen and (-moz-min-device-pixel-ratio: 1.5), 
    only screen and (-o-min-device-pixel-ratio: 3/2), 
    only screen and (min-device-pixel-ratio: 1.5), 
    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), 
    only screen and (min-device-pixel-ratio: 2), 
    only screen and (-Webkit-min-device-pixel-ratio: 3), 
    only screen and (-moz-min-device-pixel-ratio: 3), 
    only screen and (-o-min-device-pixel-ratio: 3), 
    only screen and (min-device-pixel-ratio: 3) { 
     body { 
      font-family: 'Roboto', Helvetica, sans-serif; 
      font-weight: 300; 
     } 
    } 

任何人都知道這個空間是從哪裏來的,我如何才能讓它消失

謝謝

screenshot of portrait site with viewport meta tag

screenshot of landscape site with viewport meta tag

screenshot of landscape site with no viewport meta tag

回答

0

問題實際上結束,目前深的HTML和CSS裏面。主頁上的按鈕有position: absolutetransform: translate(-75%, -50%)(以及所有前綴...),並導致額外的空間。

我將它們更改爲position: relative;並使用margin-top: 10%; margin-right: 15%設置定位。

現在看起來不錯。