背景图像在 CSS 中向上/向下填充

str*_*ger 5 css

我的 div 元素中有这个背景图像,我希望它向上/向下“填充”并覆盖其整个高度和宽度。请向我解释如何使用 CSS 实现这一点。非常感谢任何帮助。提前致谢。

wil*_*jam 3

-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
Run Code Online (Sandbox Code Playgroud)

CSS Tricks 的文档: http://css-tricks.com/perfect-full-page-background-image/