[英]How to proportionally resize the background image of a 'div'?
I need the div idPhoto
background image to be scaled proportionally according to the position of the input range
.我需要根据
input range
的位置按比例缩放div idPhoto
背景图像。
The code is this: https://jsfiddle.net/fjwpvok5/2/代码是这样的: https : //jsfiddle.net/fjwpvok5/2/
I think that the CSS property background-size
is what you're looking for.我认为 CSS 属性
background-size
就是你要找的。
Depending of what you want, you could use cover
, contain
or 100% 100%
.根据您的需要,您可以使用
cover
、 contain
或100% 100%
。
https://developer.mozilla.org/en-US/docs/Web/CSS/background-size https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.