2016-11-25 4 views
2

私はそこに背景画像を持つDIVを持っています。コンピュータ上では見た目はいいですが、携帯に行くとズームインしますか?ここでdivの背景画像はモバイルでズームインします

は私のHTMLとCSSコードは次のとおりです。お時間を

.vh { 
 
    width: 100vw; 
 
    height: 100vh; 
 
    position: absolute; 
 
    background: url("http://autohof.coersonline.nl/wp-content/uploads/2016/09/Headerplaat-4.jpg") no-repeat center center fixed; 
 
    -webkit-background-size: cover; 
 
     -moz-background-size: cover; 
 
     -o-background-size: cover; 
 
     background-size: cover; 
 
}
<div class="vh"> 
 
</div>

ありがとう!

+0

てみ '背景サイズ:100%私は、モバイル上の画像doesntの表示があることを行う' –

+0

@PrasathV。 –

+0

メタタグ ' 'を設定しましたか? –

答えて

0

あなたが直面している問題は、iOS Safariのビューポート単位での既知のバグです。それらを使用しないようにするか、this pluginを使用して修正してください。

0

背景は、次のCSSを使用して高さに反応します。

background-image: url('YOUR_IMAGE'); 
background-repeat: no-repeat; 
background-size: contain; 
background-position: center; 

html, 
 
body { 
 
    height: 100%; 
 
    width: 100%; 
 
} 
 
.vh { 
 
    height: 100%; 
 
    width: 100%; 
 
    background: url("http://autohof.coersonline.nl/wp-content/uploads/2016/09/Headerplaat-4.jpg"); 
 
    background-repeat: no-repeat; 
 
    background-size: contain; 
 
    background-position: center; 
 
    -webkit-background-size: cover; 
 
    -moz-background-size: cover; 
 
    -o-background-size: cover; 
 
    background-size: cover; 
 
}
<!doctype html> 
 
<html> 
 

 
<head> 
 
    <meta name="viewport" content="width=device-width"> 
 
</head> 
 

 
<body> 
 
    <div class="vh"> 
 
    </div> 
 
</body> 
 

 
</html>

関連する問題