Dreamweaver导致Internet Explorer中的怪癖模式 [英] Dreamweaver causing Quirks Mode in Internet Explorer

查看:89
本文介绍了Dreamweaver导致Internet Explorer中的怪癖模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Dreamweaver开发网站。我广泛使用模板功能,因为它有助于使事情更容易维护一致性。

I use Dreamweaver to develop Web sites. I use the templates feature extensively as it helps to make things easier maintaining conformance.

但是,我注意到Dreamweaver在doctype之前添加了以下代码:

However, I notice that Dreamweaver adds the following code before the doctype:

<!-- InstanceBegin template="/templates/web-public-user-home.dwt" codeOutsideHTMLIsLocked="false" -->

由于明显的原因,这使我的IE进入Quirks模式(即,在文档类型之前发表评论)。有没有办法解决这个问题?以下是我的文档类型。

This is throwing my IE into Quirks mode for obvious reasons (i.e. comment before the doctype). Is there a way of dealing with this?! Below is my doctype.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

问候

推荐答案

好,我知道了。

由于我正在进行大量的IE兼容调整,因​​此我使用了条件注释。但是,我在html标签上使用了它们。原则上没有任何问题,但是执行此操作时Dreamweaver将无法正确处理实时模板更新(它将将Dreamweaver特定的模板锁定代码放在doctype之前,从而确保您的页面在IE中抛出Quirks模式)

Because of the extensive IE-compliance tweaking I'm doing, I was using conditional comments. However, I was using them on the html tag. There's nothing wrong with this in principle but Dreamweaver won't handle your live template updates properly when you do this (It will place the Dreamweaver-specific template lock code first before the doctype, thereby ensuring that your pages will throw Quirks mode in IE).

所以我要做的是将条件注释系统从html标签上移开,而不是像这样在您打开body标签之后立即使用它们,而在您结束body标签之前立即使用它们,就像这样:

So what I did was move my conditional comment system away from the html tag, instead using them immediately after your opening body tag and immediately before your closing body tag like so:

<body>
<!--[if IE 6 ]> <div id="ie" class="ie6"> <![endif]-->
<!--[if IE 7 ]> <div id="ie" class="ie7"> <![endif]-->
<!--[if IE 8 ]> <div id="ie" class="ie8"> <![endif]-->
<!--[if gt IE 8 ]> <div id="ie"> <![endif]-->
<!--[if !IE]><div id="not-ie"> <![endif]-->

{YOUR HTML CODE}

  </div>
</body>

通过这种方式,Dreamweaver将doctype和html标记放置在模板锁定代码之前,然后生成的页面将在IE上以标准模式显示(一切正常)。

This way, Dreamweaver places the doctype and html tag before the template lock code, and your resulting pages will appear in standards mode on IE (all things being normal).

干杯。

这篇关于Dreamweaver导致Internet Explorer中的怪癖模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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