At the top of my classic asp page, I have a the following code to select the relevant stylesheet depending on which browser is being used: -

<!--[if IE 6]><link rel="stylesheet" type="text/css" href="../styles/main-ie6.css" /><![endif]-->
<!--[if gt IE 6]><link href="../styles/main.css" rel="stylesheet" type="text/css" />
<!--[else]><link href="../styles/main.css" type="text/css" rel="stylesheet" /><![endif]-->

The problem is that when the site is loaded in Google Chrome, no stylesheet is picked up.

Does anyone know how to get round this?

Many TIA

Only IE can read conditional statements, so you do not put the default css file in there, you put if before the conditional statement, and then bits in the css file loaded by IE will override the same bits in the default file.

<link href="../styles/main.css" type="text/css" rel="stylesheet" />

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="../styles/main-ie6.css" /><![endif]-->

Every other browser will get main.css, and ie6 alone will get main-ie6.css

simples.

Only IE can read conditional statements, so you do not put the default css file in there, you put if before the conditional statement, and then bits in the css file loaded by IE will override the same bits in the default file.

<link href="../styles/main.css" type="text/css" rel="stylesheet" />

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="../styles/main-ie6.css" /><![endif]-->

Every other browser will get main.css, and ie6 alone will get main-ie6.css

simples.

Thanks man

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.