Matthew
Matthew

Reputation: 4339

Does order of html meta tags matter?

I have an asp.net web form with a head section like this:

<head runat="server">
    <title>Web application</title>
    <link rel="Stylesheet" href="resources/material.min.css" />
    <link rel="Stylesheet" href="resources/style.css" />
    <link rel="shortcut icon" type="image/x-icon" href="resources/favicon.ico" />
    <script type="text/javascript" src="resources/material.min.js"></script>
    <meta http-equiv="X-UA-Compatible" content="IE=10"/>
</head>

The application won't work in Internet Explorer compatibility mode, which unfortunately our firm enables in IE by default. Normally I fix this by adding the meta tag above, but for some reason this isn't working on this page. If I move the meta tag to the top of the <head> section, before the style sheets, it does work. So my question is this: is there a reason the order matters? I'm baffled.

Upvotes: 2

Views: 2209

Answers (1)

mattsven
mattsven

Reputation: 23253

Yes, order matters. The browser procedurally processes HTML. If the meta tag is first, Internet Explorer knows to use Compatibility Mode almost as soon as it starts parsing the document. Otherwise, it's already started parsing and processed everything else - your CSS, JavaScript, not in Compatibility Mode.

Upvotes: 3

Related Questions