...

View Full Version : Conditional Comments for Firefox on Mac?



kevinorin
04-12-2011, 05:02 PM
I have coded for years n windows and have recently been forced to start coding on a MAC. FireFox for MAC and FireFox for Windows DO have differences when reading CSS.

The problem I currently have that let me to the forum is the nav menu for 1 of our sites:

#nav li a { padding:10px 20px 6px 10px; }

In ALL browsers on Windows and Mac the above is fine, but the menu is off by 1 pixel in FF for MAC and only works like the others if code is:

#nav li a { padding:9px 20px 6px 10px; }

Still looking for Mac conditional CSS.

And yes I have tried using W3 standards (padding-top, padding-right, etc...)

Regards,

Kevin W
www.kevinw.me

angst
04-12-2011, 05:08 PM
hi kevinorin, I ended up making my style.css into style.php,
then I use



$d = detect();
$b = $d['browser'];
$v = $d['version'];
$o = $d['os'];
function detect(){
$browser = array ("IE","OPERA","MOZILLA","NETSCAPE","FIREFOX","SAFARI");
$os = array ("WIN","MAC");
$info['browser'] = "OTHER";
$info['os'] = "OTHER";
foreach ($browser as $parent){
$s = strpos(strtoupper($_SERVER['HTTP_USER_AGENT']), $parent);
$f = $s + strlen($parent);
$version = substr($_SERVER['HTTP_USER_AGENT'], $f, 5);
$version = preg_replace('/[^0-9,.]/','',$version);
if ($s){
$info['browser'] = $parent;
$info['version'] = $version;
}
}
foreach ($os as $val){
if (eregi($val,strtoupper($_SERVER['HTTP_USER_AGENT']))) $info['os'] = $val;
}
return $info;
}



then in the file I add conditions, like;


<? if ($b =="FIREFOX" && $os == "MAC"){ ?>


and so on.


I know that some people disagree, but I've run into issues like this a few times.
works perfectly with FF on windows & linux, but then breaks on mac. strangeness...

VIPStephan
04-12-2011, 05:17 PM
Hang on, hang on! That’s stupid (if I may be this direct). There is absolutely no need to write a conditional for Firefox on different OSs. Either the design is too restrictive in that it doesn’t adapt to different circumtances and user customs or the code is bad.

I could imagine that there are pixel rounding differences when the viewport is resized. If this can’t be overcome by a different approach to sizing (i. e. parent elements etc.) then give your design enough room to coope with a one pixel difference. Especially in the design above I don’t see any reason why a pixel would be a problem.

angst
04-12-2011, 05:26 PM
i'm not interested in arguing. this is an old post. but like it or not, there are some rendering differences. I built the pages from ground up. works on every browser in all OS's except FF on mac.

AOpie
04-12-2011, 10:31 PM
I'm having a problem with a page in Firefox - everything looks okay except for the background lining up. Its someone else's code that i'm modifying, and its a disaster to begin with, so I was just hoping it would somehow work out. Every time I breathe on it something goes wrong. This is the link www.manayunkselfstorage.com/request2.html (http://www.manayunkselfstorage.com/request2.html)
Any advice would be so much appreciated!

oesxyl
04-12-2011, 10:40 PM
I'm having a problem with a page in Firefox - everything looks okay except for the background lining up. Its someone else's code that i'm modifying, and its a disaster to begin with, so I was just hoping it would somehow work out. Every time I breathe on it something goes wrong. This is the link www.manayunkselfstorage.com/request2.html (http://www.manayunkselfstorage.com/request2.html)
Any advice would be so much appreciated!
when you have a problem is better to start a new thread instead of 'reuse' one closer to your problem because the probability to get an answer here is pretty low.
as op page from this thread, your page have invalid markup and this is the main problem with the way how it look in different browsers.

http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.manayunkselfstorage.com%2Frequest2.html

try to validate first and then if you still have problems start a new thread.

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum