Rob*_*cha 2 html css background background-image
我正在尝试将背景图像放置在body标签的背景中,right bottom但由于某种原因,该图像几乎完全不可见。除了解决方案之外,我还想了解为什么这不像我预期的那样工作。我将组合更改为其他设置,例如left bottom静态图像不在视野中。
图片是这个:https : //i.stack.imgur.com/fpKuw.jpg?s=328&g=1
body {
background-image: url(https://i.stack.imgur.com/fpKuw.jpg?s=328&g=1);
background-repeat: no-repeat;
background-position: right bottom;
}Run Code Online (Sandbox Code Playgroud)
<body>
</body>Run Code Online (Sandbox Code Playgroud)
在body没有足够的height尚未得到渲染图像不如预期,所以你可以在这几个方面:
html, body { height:100%}html,
body {
height: 100%
}
body {
background: url(https://i.stack.imgur.com/fpKuw.jpg?s=328&g=1) no-repeat right bottom;
}Run Code Online (Sandbox Code Playgroud)
body { height:100vh}body {
background: url(https://i.stack.imgur.com/fpKuw.jpg?s=328&g=1) no-repeat right bottom;
height: 100vh
}Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2967 次 |
| 最近记录: |