【发布时间】:2012-03-12 01:13:41
【问题描述】:
困境:制作一个全窗口的 svg 图像,不使用 SVG 标签,但不使用 SVG 标签。为什么没有svg标签?因为我打算在页面的生命周期中稍后(如果不经常)换掉 SVG,但我还没有找到一个简单的方法来做到这一点。
失败的尝试:
<!-- for the record, my style are in a css file,
for example purposes they are style attrs-->
<!-- Working in Webkit but not in firefox, in firefox blocks stretching
and places the svg in the middle of the tag-->
<img src="my.svg" style="width:100%;height:100%;
position:fixed;top:0;left:0;bottom:0;right:0;" />
<!-- Both Webkit and Firefox block distortion, so the svg
appears centered in the div rather than conforming to the div-->
<div style="width:100%;height:100%;position:fixed;top:0;
left:0;bottom:0;right:0;background-size:cover;
background-image:url(my.svg);" />
我也试过
background-size:contain;
background-size:cover;
background-size:100% 100%;
background-postion: center center;
但没有运气。
【问题讨论】:
-
我的帖子中的
<object>标签在哪里?