我有一个文件的代码如下:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="400" height="110">
<rect width="400" height="110" style="fill:rgb(0,0,255);" />
</svg>
如果我从Web浏览器(firefox、chromium)打开该文件,则不会显示矢量图像。相反,文件以XML格式显示:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<svg width="400" height="110">
<rect width="400" height="110" style="fill:rgb(0,0,255);"/>
</svg>
原因出在SVG图中,没有加入:
<svg width="400" height="110" xmlns="http://www.w3.org/2000/svg">
<rect width="400" height="110" style="fill:rgb(0,0,255);"/>
</svg>
评论区