惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

博客园 - 笨笨丁

IIS启用兼容模式设置(win2k3—Win7) C#调用java类、jar包方法(转) Nice Validator(Form验证)及Juery zTree控件 ASP.NET程序中 抛出"Thread was being aborted. "异常(转) SQL语句Where中使用别名作为判断条件 50个令人惊奇的jQuery插件(对话框和表单篇)及免费的响应式bootstrap管理员后台界面主题 - Charisma PowerDesigner设计时表显示注释选项 showModalDialog 的重要提示 在网页中怎样给已发布的Flash添加链接的方法(zhuan) ASP.NET网站中获取当前虚拟目录的应用程序目录的方法(转) __doPostBack()没有定义解决方法(转) jQuery插件实战之fullcalendar(日历插件) - 使用fullcalendar开发一个功能完整的富客户端会议室预定系统(转) ajaxpro返回值类型总结-DataTable(转) Ibatis.net总是报:【ExecuteStoreCommand SqlParameterCollection 中已包含 SqlParameter】(转) jQuery校验validate详解(转) 一个.NET通用JSON解析/构建类的实现(c#)转 C# JSON字符串序列化与反序列化(转) AjaxPro新发现-错误处理 SVN专题:SVN Client API的.net 接口 SharpSvn介紹 Checkout操作实例,SVN权限(转)
解决VML遭遇IE8和XHTML DOCTYPE时不能运行的问题(转)
笨笨丁 · 2013-11-08 · via 博客园 - 笨笨丁

原文网址:http://blog.csdn.net/cuixiping/article/details/4227283 

以下代码在IE运行正常

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
< html xmlns:v="urn:schemas-microsoft-com:vml">
< head><title>VML</title>
< style> v/:* { behavior: url(#default#VML); } </style>
< /head>
< body>
< v:rect id=myrect filled="false" stroked="false" rotation="45"
style="position:relative;width:165px;height:55px;border:none;rotation:45;">
<v:imagedata src="http://www.csdn.net/Images/logo_csdn.gif"/>
< /v:rect>
< /body>
< /html>

如果将DOCTYPE换成XHTML的(如下)则不能运行:

<!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><title>VML</title>
< style> v/:* { behavior: url(#default#VML); } </style>
< /head>
< body>
< v:rect id=myrect filled="false" stroked="false" rotation="45"
style="position:relative;width:165px;height:55px;border:none;rotation:45;">
<v:imagedata src="http://www.csdn.net/Images/logo_csdn.gif"/>
< /v:rect>
< /body>
< /html>

经多方查证,得知故障原因为XHTML环境下v/:*在样式表语法中是非法的,因而被IE8忽略而导致无法渲染VML(说明:IE7下的XHTML仍然能够识别v/:*),而如下代码则可以正确渲染VML:

<!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><title>VML</title>
< ?import namespace="v" implementation="#default#VML" ?>
< style> v/:rect,v/:rect,v/:imagedata { display:inline-block } </style>
< /head>
< body>
< v:rect id=myrect filled="false" stroked="false" rotation="45"
style="position:relative;width:165px;height:55px;border:none;rotation:45;">
<v:imagedata src="http://www.csdn.net/Images/logo_csdn.gif"/>
< /v:rect>
< /body>
< /html>

秘诀就是:

<?import namespace="v" implementation="#default#VML" ?>
< style> v/:rect,v/:rect,v/:imagedata { display:inline-block } </style>

(1)通过import来引入命名空间

(2)将所有用到的vml元素分开写入样式{ display:inline-block }

参考网址:

https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=333905