【问题标题】:SVG not rendering properly in SAFARISVG 无法在 SAFARI 中正确呈现
【发布时间】:2012-04-01 05:53:58
【问题描述】:

在所有其他浏览器中,我让 SVG 显示为页面宽度的 80%。但是在 Safari 中,我在更大的可滚动(水平和垂直)区域内获得了尺寸减小的 svg。

我一直在阅读,我认为问题在于 safari 需要 .xhtml(它不会在 .html 中解析 svg),但是正如您所看到的那样,这是 .php 所以我更改了标题/内容-类型......但仍然没有。有任何想法吗?

 <?php header('Content-Type: application/xhtml+xml; charset=utf-8'); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">     
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<style> 
#svgobject{width: 80%;margin-right:auto;margin-left:auto;}
</style>   
  </head>
 <body>
<object type="image/svg+xml" id="svgobject" data="question0final.svg" >  
 </object>
</body>
</html>

【问题讨论】:

  • question0final.svg 的代码是什么样的?
  • 这里无论如何都不需要使用 xhtml,因为 svg 元素没有嵌入到您发布的文档中。

标签: safari svg content-type


【解决方案1】:

我删除了它,它修复了我的 Safari 渲染问题

<svg version="1.1" id="Background_1_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="350.08px" height="290.066px" viewBox="0 0 350.08 290.066" enable-background="new 0 0 350.08 290.066" xml:space="preserve">

【讨论】:

    【解决方案2】:

    事实证明,我的 SVG 图像的真正问题在于,当使用 illustrator 转换它们时,我的图像文件中有分组元素和嵌入的位图,而 Safari 根本不喜欢这样。 我会在 Safari 中看到所有未分组的元素或位图,使图像未完成。 希望这可以帮助其他遇到此问题的人。

    【讨论】:

      猜你喜欢
      • 2020-05-02
      • 2021-12-17
      • 1970-01-01
      • 1970-01-01
      • 2017-06-28
      • 1970-01-01
      • 2018-03-01
      • 1970-01-01
      • 2021-11-19
      相关资源
      最近更新 更多