I am trying to make by background image fit to the screen, but I'm not sure what to add to my code.
<body background= "b.png">
If anyone could suggest what to put and where that would be great.
答案 0 :(得分:0)
将以下CSS应用于样式表中的body标签。您可以更改属性的值以匹配您希望背景显示的方式。
body {
margin:0;
padding:0;
background-image: url(b.png);
background-repeat: repeat-y;
background-attachment: fixed;
background-position: top center;
background-size: cover;
-webkit-background-size:cover;
width: 100%;
height: 100%;
min-width: 100%;
min-height: 100%;
-webkit-background-size: auto auto;
-moz-background-size: auto auto;
-o-background-size: auto auto;
background-size: auto auto;
position:relative;
}
答案 1 :(得分:0)
如其中一条评论中所述,将其放入CSS:
body {
background-image:url("../images/myImage.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
}
html {
height: 100%
}