[英]How to add background image using css without having images being duplicated
I want to make login form using hmtl, css and one function with javascript, but when i add image url to my body class in css i get displayed few images instead of one that fits the whole screen size. I want to make login form using hmtl, css and one function with javascript, but when i add image url to my body class in css i get displayed few images instead of one that fits the whole screen size. Any solution?
有什么解决办法吗?
[enter image description here][1] [在此处输入图片描述][1]
how are you adding the image, with background-image
?你是如何使用
background-image
? You could try to add also background-size: cover
, which will scale the image (while preserving its ratio) to the smallest possible size to fill the whole container.您也可以尝试添加
background-size: cover
,它将图像(同时保持其比例)缩放到尽可能小的尺寸以填充整个容器。
example例子
body {
background-image: ...
background-size: cover;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.