![](/img/trans.png)
[英]I applied CSS auto-resizing to image, now how do I push it to the background?
[英]How do I make a resizing background image in css?
到目前为止我所拥有的是:
body {
background-image: url("image file");
background-size: cover;
background-repeat: no-repeat;
}
我在下面找到了答案。
使用background-size:cover
,背景将根据其父元素的大小自动缩放以覆盖整个事物。
在这种情况下,为了放大或缩小它,您可以在 body 元素上设置宽度和高度。
用这个:
background-size: 100% 100%;
水平和垂直拉伸:
background-size: 100% 100%;
水平拉伸(保持图像比例):
background-size: 100%;
background-size: 100% auto; /* This is the same as above (included so you can see the similarities below). */
垂直拉伸(保持图像比例):
background-size: auto 500px; /* If you use percentage (100%), you must set the height of the containing element. */
我终于找到了一个答案,我所要做的就是修改你的一个答案
body {background-image: url("image file");
background-size: 110% 130%;
background-repeat:no-repeat;
谢谢你的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.