0

有人可以为此类问题提供答案吗?我正在尝试将一些矢量图形放入 HTML。实际上在我的情况下没有必要,所以我现在可能会求助于简单的图像,但是我遇到了一个问题,我无法解决,定义出了什么问题变得非常有趣并且与未来相关。顺便说一句,VML 对我来说绝对是新的。

我尝试在一个页面中插入几个 vml 元素,其中一些效果很好(在 IE6、IE7 中),即“椭圆形”、“矩形”。但是当我试图插入一个形状或圆形时,一切都出错了。

实际问题是:IE6、IE7 中是否有令人满意的 VML 支持,或者我做错了什么?但就我检查我的代码而言,一切都是正确的。下面我放个样例,大家可以在IE浏览器中测试一下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1  /DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>sample</title>

<style>

  v\:* { behavior: url(#default#VML); display:inline-block}

  #div1 {

    width:400px;

    height:400px;

    background-color:#e4fe56;

  }

</style>

</head>

<body>

  <div id="div1">

    <v:shape style='width:100px;height:100px' fillcolor="red" path="m 0,0 l 30,0,30,30 xe" />

    <v:rect style='width:100pt;height:75pt' fillcolor="blue" strokecolor="red" strokeweight="3.5pt"/>

    <v:roundrect style='width:100pt;height:75pt" arcsize="0.3" fillcolor="yellow"   strokecolor="red" strokeweight="2pt"/>

  </div>

</body>

</html>

另外我发现它只发生在严格模式下。当 IE 在 quirks 模式下工作时删除 DOCTYPE 或在其他条件下一切正常。

4

1 回答 1

1

您的样式属性引号不匹配

<v:roundrect style='width:100pt;height:75pt"

您的文档类型中有空格:

/xhtml1  /
于 2012-01-17T20:05:11.493 回答