1

I'm trying to include an IE7-only stylesheet using a conditional comment:

<head> <meta charset="utf-8"> <title>Title</title> <meta name="description" content="Description"> <link href="/static/styles/bootstrap.min.css" rel="stylesheet"> <link href="/static/styles/font-awesome.min.css" rel="stylesheet"> <link href="/static/styles/main.css" rel="stylesheet"> <link href='//fonts.googleapis.com/css?family=Quicksand:700' rel='stylesheet' type='text/css'> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- [if IE 7]> <link type="text/css" rel="stylesheet" href="/static/styles/ie7.css"> <![endif]--> <link rel="icon" type="image/png" href="/static/images/layout/favicon.png"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> </head> 

I have a Windows 7 virtual machine (running on VirtualBox) and I'm using the developer's tools in IE9 to switch the browser mode to IE7. Nothing in the referenced stylesheet is applied to the page. I'm loading this stylesheet after all others, I'm using !important on everything, and I've triple-checked the file name and path, but the styles are still not being applied. Can anyone see where I've gone wrong?

2
  • I am not sure but perhaps the IE9 browser mode is not quite equal to IE7. Have you tested it on an IE7 virtual machine to rule out this factor? Commented Mar 7, 2013 at 22:48
  • You have a space in this line: <!-- [if IE 7]>, don't remember if the syntax allows that to be there? Possibly not. Commented Mar 7, 2013 at 22:50

1 Answer 1

4

there is a space

<!--RIGHT HERE[... remove that one 

before:

<!-- [if IE 7]> <link type="text/css" rel="stylesheet" href="/static/styles/ie7.css"> <![endif]--> 

after:

 <!--[if IE 7]> <link type="text/css" rel="stylesheet" href="/static/styles/ie7.css"> <![endif]--> 

not sure if thats it though

Sign up to request clarification or add additional context in comments.

1 Comment

Holy crap. That was it. I had no idea that the space mattered. Never would have caught that. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.