Title: cross-browser CSS question
Last modified: August 18, 2016

---

# cross-browser CSS question

 *  [tjinh200](https://wordpress.org/support/users/tjinh200/)
 * (@tjinh200)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/)
 * i remember that there is a way, in your stylesheet to specify IE and Mozilla 
   and what to do for either instance, but i can’t seem to remember … is there a
   good way to ensure cross-browser compatibility? (using px, pt, em, % is not working)…

Viewing 7 replies - 16 through 22 (of 22 total)

[←](https://wordpress.org/support/topic/cross-browser-css-question/?output_format=md)
[1](https://wordpress.org/support/topic/cross-browser-css-question/?output_format=md)
2

 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171110)
 * tinh you are in a bit of a muddle. That if conditional statement you put up earlier
   works very well in _ the xhtml _. Not the CSS . CSS is not executable.
 *  Thread Starter [tjinh200](https://wordpress.org/support/users/tjinh200/)
 * (@tjinh200)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171121)
 * the only way that the correct stylesheet will show up is if i put style.css under
   the “else” and “style-ie.css” doesn’t show on FF or IE … any thoughts?
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171250)
 * Not many of them. I would recommend, for testing, to do a single if/else:
 * `<?php if (strpos(true == $_SERVER['HTTP_USER_AGENT'],'Gecko')) { ?>
    <link rel
   =stylesheet type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/
   style.css"> <?php } else { ?> <link rel=stylesheet type="text/css" href="<?php
   bloginfo('stylesheet_directory'); ?>/style-ie.css"> <?php } ?>
 * This *should* load style.css in Firefox and current Netscape browsers, and style-
   ie.css in everything else.
 *  Thread Starter [tjinh200](https://wordpress.org/support/users/tjinh200/)
 * (@tjinh200)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171311)
 * for some reason, with that code, FF is still loading the style-ie.css, and IE
   is loading style-ie.css also …
 *  [infocynic](https://wordpress.org/support/users/infocynic/)
 * (@infocynic)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171420)
 * I don’t know why that if() test is written like that, and I suspect that’s causing
   trouble. As I read the code, it’s looking for ‘Gecko’ inside the string _returned
   by the statement `true == $\_SERVER...`_, which is going to be “1”, not the actual
   user agent. I suspect what we’re trying to avoid is the whole problem with strpos
   returning 0 for “string found at 0th character” vs. strpos returning false for“
   string not found.” Try this:
 * `<?php if (strpos($_SERVER['HTTP_USER_AGENT'],'Gecko')!==false) { ?><link rel
   =stylesheet type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/
   style.css">
    <?php } else { ?> <link rel=stylesheet type="text/css" href="<?php
   bloginfo('stylesheet_directory'); ?>/style-ie.css"> <?php } ?>
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171424)
 * Looking it over, I see IC is correct. I’ve been mistakenly misleading you with
   the code above. Ouch. No excuses.
 * So either
 * if(strpos($_SERVER[‘HTTP_USER_AGENT’],’Gecko’)!=false)
 * or
 * if(strpos($_SERVER[‘HTTP_USER_AGENT’],’Gecko’)==true)
 * will work. And sorry about that, tjinh200 .
 *  [fuzzy_logic](https://wordpress.org/support/users/fuzzy_logic/)
 * (@fuzzy_logic)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171462)
 * Very useful info here. Thanks guys!

Viewing 7 replies - 16 through 22 (of 22 total)

[←](https://wordpress.org/support/topic/cross-browser-css-question/?output_format=md)
[1](https://wordpress.org/support/topic/cross-browser-css-question/?output_format=md)
2

The topic ‘cross-browser CSS question’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 22 replies
 * 6 participants
 * Last reply from: [fuzzy_logic](https://wordpress.org/support/users/fuzzy_logic/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/cross-browser-css-question/page/2/#post-171462)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
