SVG作为背景图像,跨浏览器兼容 [英] SVG as background Image, cross browser compatibility

查看:96
本文介绍了SVG作为背景图像,跨浏览器兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用SVG作为背景图像时,如果我需要正确调整图像大小,则必须为不同的浏览器指定单独的背景位置.

While using SVG as background image, if I need to fit the image correctly, then have to specify separate background positions for different browsers.

是我经历的方式,还是我做错了事.

Is it the way I experienced, or I am doing something wrong.

我要使用的CSS:

.some {
  background: transparent url('some.png') no-repeat -X1px -Y1px;
  background: rgba(0,0,0,0) url('some.svg') no-repeat -X2px -Y2px;
  width: 53px;
  height: 14px;
  position: relative;
  top: 13px;
  left: 30px;
}

推荐答案

要缩放svg背景,可以使用:

To scale your svg background, you can use:

background-size: 53px 14px;

这篇关于SVG作为背景图像,跨浏览器兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆