<!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/particles.js@2.0.0/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;
}
答案 0 :(得分:1)
你没有在background属性后添加分号:
#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 */
}