目前的代码是
<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Full Page Background Image</title>
<style>
* { margin: 0; padding: 0; }
html {
background: url(./images/bg.jpg) no-repeat center center fixed !important;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
</body>
</html>
它显示全屏背景图像。但是,我试图添加bootstrap css,背景图片不见了。
<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Full Page Background Image</title>
<link href="./bootstrap/css/bootstrap.css" rel="stylesheet">
<script src="./js/jquery.min.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
<style>
* { margin: 0; padding: 0; }
html {
background: url(./images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover ;
-moz-background-size: cover ;
-o-background-size: cover ;
background-size: cover;
}
</style>
</head>
<body>
</body>
</html>
我想知道为什么以及如何解决这个问题?
答案 0 :(得分:2)
使用body
而非html
用于CSS
<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Full Page Background Image</title>
<link href="./bootstrap/css/bootstrap.css" rel="stylesheet">
<script src="./js/jquery.min.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
<style>
* { margin: 0; padding: 0; }
body {
background: url(./images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover ;
-moz-background-size: cover ;
-o-background-size: cover ;
background-size: cover;
}
</style>
</head>
<body>
</body>
</html>
答案 1 :(得分:0)
添加
后它正在工作body {
background: none;
}