2017-12-31 152 views
0

私の質問がばかげている場合は私はこれらのすべての技術に素早く慣れています。私の目的は、それが大きなサイズの画像であるのでズームしていない間にデフォルトのサイズで画像の背景を追加することです。問題は、いくつかのスタイルを追加すると、画像が表示されず、背景が空白になります。ちなみに、この背景画像の上にparticle.jsを使用してIMします。 いくつかのスタイルを追加した後に背景画像が消える

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta http-equiv="X-UA-Compatible" content="ie=edge"> 
    <title>Infinite Space !</title> 
    <link rel="stylesheet" href="style.css"> 
</head> 
<body > 
    <div id="particles-js"></div> 

    //particle-js configues 
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/particles.min.js"> 
    </script> 
    <script> 
    particlesJS.load('particles-js', 'particles.json', function() { 
     console.log('callback - particles.js config loaded'); 
     }); 
    </script> 


    </div> 
</body> 
</html> 



#particles-js{ 

    background: url("https://d14xs1qewsqjcd.cloudfront.net/assets/bg-header-star.jpg") 
    width: 100%; 
    min-height: 800px; 
    background-size: contain; 
    background-repeat: no-repeat; 
    background-position: center; 
    /* background-attachment: fixed; 
} 

答えて

1

あなたはbackgroundプロパティの後にセミコロンを追加didntは:

#particles-js{ 

    background: url("https://d14xs1qewsqjcd.cloudfront.net/assets/bg-header-star.jpg") /* <---- Semicolon goes here*/ 
    width: 100%; 
    min-height: 800px; 
    background-size: contain; 
    background-repeat: no-repeat; 
    background-position: center; 
    /* background-attachment: fixed; /* Also you didnt close this comment */ 
} 
関連する問題