[英]background image zoom in firefox
While I was working on the project I faced with the problem of scaling in firefox under an operating system windows. 当我从事该项目时,我遇到了在操作系统窗口下使用Firefox缩放的问题。 If you change the scale of the browser page with a 100% up to 90% (for example), cut off the background-image, the problem appears only in firefox and only in windows or ubuntu, on mac os is working correctly.
如果您将浏览器页面的缩放比例从100%更改为90%(例如),则切断背景图像,则该问题仅在Firefox中出现,并且仅在Windows或Ubuntu中出现,在Mac os上正常工作。 Possibly someone faced and will suggest how you can fix this bug.
可能有人遇到,并会建议您如何解决此错误。
example: http://jsfiddle.net/uL53nd7z/1/ 示例: http : //jsfiddle.net/uL53nd7z/1/
div {
background-image: url(http://oi60.tinypic.com/jal5wh.jpg);
background-repeat: no-repeat;
height: 23px;
width: 23px;
}
You can add relative units to your height and width with background-size: cover
so your image take all the content of your div. 您可以使用
background-size: cover
在高度和宽度上添加相对单位,以便图像使用div的所有内容。 Depending on your target audience you can use em
or rem
so they gonna "follow" the modification of a page. 根据您的目标受众,可以使用
em
或rem
以便他们“关注”页面的修改。
My code : 我的代码:
html {
font-size: 12px;
}
div {
background-image: url(http://oi60.tinypic.com/jal5wh.jpg);
background-repeat: no-repeat;
height: 1.916666666666667rem; /*23/12*/
width: 1.916666666666667rem;
-webkit-background-size: cover;
background-size: cover;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.