...

View Full Version : change body background if IE



simonstaton
12-11-2009, 02:02 PM
Hi,

is it possible to have a different background image on IE to firefox, I am doing my background image as shown below:


<body style="background-image: url(unbranded_bg.png);">

however I want script that says if IE, show unbranded_bg2.png and if firefox show unbranded_bg.png.

Many Thanks,
Simon

abduraooft
12-11-2009, 02:12 PM
Use IE's conditional comments (http://www.quirksmode.org/css/condcom.html).

simonstaton
12-11-2009, 02:19 PM
is there a way I can do it for all internet explorer versions? and also where abouts would I put that? im still learning javascript as I go along.

Kor
12-11-2009, 02:56 PM
is there a way I can do it for all internet explorer versions? and also where abouts would I put that? im still learning javascript as I go along.
It is not about javascript but CSS. Give your element a class, and create separate external CSS files, one for IE, one for the others. Use the conditional comments. The CSS file for IE should be loaded after the other one.


<head>
...
...
<link href="css/standard.css" rel="stylesheet" type="text/css">
<!--[if IE]>
<link href="css/ie.css" rel="stylesheet" type="text/css">
<![endif]-->
</head>

simonstaton
12-11-2009, 03:05 PM
thanks worked



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum