如何让VML在标准模式下工作? [英] How do I get VML working in standards mode?

查看:113
本文介绍了如何让VML在标准模式下工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在标准模式下使用vml对象而不是quirks模式。我发现散布的答案碎片却无法解决。 拉斐尔以某种方式将其拉出来,但我无法扭转它以弄清楚发生了什么。任何基本的工作示例都会很棒。

I would like to be able to use vml objects on a page rendering in standards mode rather than quirks mode. I've found fragments of answers scattered around but can't figure it out. Raphael pulls it off somehow but I can't reverse it to figure out what's happening. Any basic working example would be great.

推荐答案

我想我已经弄清楚了。第1步是通过javascript导入vml命名空间。

I think I have it figured out. Step 1 is importing the vml namespace though javascript.

document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', "#default#VML");

这使得一些随机的vml样本在怪癖模式下工作,但不是标准。关键是元素需要一个单位进行测量,如果没有提供单位,则怪癖模式将假设为px。另外,形状必须使用 position:absolute; 进行样式设置,尽管线条显然不需要此部分。

This got some random vml samples to work in quirks mode but not standards. They key is that elements require a unit for measurements where quirks mode will assume px if a unit is not provided. Also shapes have to be styled with position:absolute; although lines apparently do not need this part.

这是一个样品有2个椭圆形。两个椭圆都将以怪异模式呈现,但蓝色椭圆将不会以标准模式显示。

Here's a sample with 2 ovals. Both ovals will render in quirks mode but the blue oval will not show in standards mode.

<!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></head>
<body>
    <script>
        document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', "#default#VML");
    </script>
    <v:oval style="width: 100; height: 50" fillcolor="blue"></v:oval>
    <v:oval style="position: absolute; width: 100px; height: 50px" fillcolor="green"></v:oval>
</body>
</html>

这篇关于如何让VML在标准模式下工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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