Dreamweaver causing Quirks Mode in Internet Explorer

前端 未结 2 1832
忘了有多久
忘了有多久 2020-12-19 14:29

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

However, I notice that Dre

相关标签:
2条回答
  • 2020-12-19 15:12

    Ok, I figured this out.

    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).

    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>
    

    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).

    Cheers.

    0 讨论(0)
  • 2020-12-19 15:20

    Dreamweaver (incl. CS6) places the <!-- InstanceBegin template="... comment in front of the doctype tag only if it is unable to locate the opening <html> tag in your template! This happens when you forgot that tag altogether, but also when that tag is placed within conditional comments like this:

    <!--[if IE 8]> <html class="ie8"> <![endif]-->
    

    To avoid this you have to refrain from enclosing the <html> tag within conditional comments. When you use a normal undisguised <html> tag in your template code, Dreamweaver will automatically place the <!-- InstanceBegin template="... after that <html> tag in all files derived from that template and IE will not fall into quirks mode.

    0 讨论(0)
提交回复
热议问题