Hi

i was wondering if there is a way to point Drupal to different stylesheets according to browser detection. i ll appreciate all and any help...we all know how crusial this is. I basically need to proivide 2 different style sheets, one for IE5.0 &> and one for Mozilla based browsers.

thanks
Panos

Comments

firstov’s picture

can't you put a small java script into your page template file to detect a browser and select a second stylesheet file in case it's IE?

dvessel’s picture

You don't need anything fancy for this. Just look at conditional comments. Only IE knows about them. Other browsers will ignore.

http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp

joon

pan0s’s picture

im aware of conditional comments...what im not aware of is how im suppose to apply theses conditional comments.
(myThought) Replace the <?php print $styles ?> in header with <?php print '<!--[if IE]> <link href="..." /> <![endif]-->' ?>
What about that?

-----------------------------------------------------------------------------------------
Some people say the glass is half-full while others say its half-empty....i say bottoms up.

dvessel’s picture

As long as the IE styles go in after your main styles it will override and cascade properly. Are they so drastically different that it's one or the other? Sounds like more maintenance than it's needed if that's so.

Something like this will do fine. It assumes your windows styles are in the base of your theme directory.
>= IE 5:

<!--[if gte IE 5]>
<?php echo theme('stylesheet_import', url($directory.'/win.css')) ?>
<![endif]-->

It'll print out all the time but IE will detect and act accordingly.

joon

pan0s’s picture

thank you for your kind support , the truth is that there are no such big differences but i want to tide things up ;) i have a huge style.css that contains styling for both browsers and it gets pretty annoying try finding the right selector.....
thanks again
u have a very nice and stylish site btw!

panos

-----------------------------------------------------------------------------------------
Some people say the glass is half-full while others say its half-empty....i say bottoms up.

talyia’s picture

This was a very helpful post for me as I was having a lot of problems getting my conditional comments to work as they should!

Christine