2017-06-17 18 views
-1

上の画面全体をカバーこれは私のコードです:背景画像を作るためにどのようにモバイル

body { 
 
\t 
 
\t margin: 0px; /* Background Image Margin will be 0 */ 
 
    background-image: url('https://static.pexels.com/photos/17679/pexels-photo.jpg'); /* Background Image Linki */ 
 
    background-repeat: no-repeat; /* Background Image Will not repeat */ 
 
    background-attachment: fixed; /* Background Image will stay fixed */ 
 
    background-size: cover; /* This will make background image width 100% and height 100% */ 
 
\t 
 
\t 
 
}
<h1>Hello</h1>

それは完全に正常に動作しています。ブラウザのサイズを変更したり、Google Chromeでf12>モバイルサイズを使用すると、正常に動作しています。

実際のモバイルデバイスで使用する場合、幅は100%、高さも100%です。つまり、携帯端末の写真は60%の高さしかカバーしていません。

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

答えて

-1

body { 
 
\t 
 
\t margin: 0px; 
 
    background-image: url('https://www.w3schools.com/css/img_fjords.jpg'); 
 
    background-repeat: no-repeat; 
 
    background-attachment: fixed; 
 
    background-size: cover; 
 
\t 
 
}
<h1>hi</h1>

私はこのmetaタグを使用しています

関連する問題