homepage Welcome to WebmasterWorld Guest from 107.20.25.215
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

    
Is there a way to show CSS code only to FF?
Trying to get equal front sizes in 3 browsers
wes50




msg:3245301
 3:50 pm on Feb 7, 2007 (gmt 0)

I'm having a problem getting font sizes to appear the same in FF 2.0,
IE7, and Opera 9.10. I can adjust IE to look the same as FF with the
following:

body {
...
font-size:1.2em;
*font-size:0.9em;
}

The problem comes when I try to adjust Opera, which for some reason is displaying much larger type. I'm trying to use the "Be Nice to Opera" hack, but I must be doing something wrong, because FireFox is picking up on it and displaying type that is way too small:

body {
...
font-size:1.2em;
*font-size:0.9em;
voice-family: "\"}\"";
voice-family:inherit;
font-size:0.8em;
}

My questions: 1) Can anyone tell me if I'm goofing up the Be Nice to Opera hack? (I've never needed this one before.)

2) Is there any way anyone knows to show CSS code just to FF, i.e., analogous to the two other hacks above?

Thanks for any help you can provide!

 

JAB Creations




msg:3253064
 5:04 am on Feb 15, 2007 (gmt 0)

You can cloak based on the useragent. I am currently looking in to serving secondary "patch" CSS files to remedy older browsers. I've been able to make MSIE 4, Opera 5, and Netscape 4 usable in my personal test cases.

PHP Example
<?php $useragent = $_SERVER['HTTP_USER_AGENT'];
if (eregi("Firefox/1.0", "$useragent")){echo 'Firefox Detected';?>

All you need to do is test the useragent string for the browser and version. Keep in mind that with Gecko browsers you should detect the revision number. For example I currently have an XHTML patch for Gecko 1.7 and older to enable overflow divisible elements to scroll.

Lastly keep in mind the order of how you serve your stylesheets is important.

Main StyleSheet First
Patch StyleSheet second

Anything after your main stylesheet will override your first "master" stylesheet and you'll only need to tweak your classes minimally in your patch CSS. I also use IECCSS for IE 5+ but am implementing this patching technique for MSIE 4. Hopefully you don't need to go that far back, I just like being leet. :-D

- John

SuzyUK




msg:3263992
 10:09 am on Feb 26, 2007 (gmt 0)

Hi wes50

firstly not really sure why you're trying to make font-sizes look the same.. using CSS you can only "suggest" a font size for a page especialy when using em's or %. The outcome will be based on the end users Browser preferences. If you are seeing different sizes in the different browsers you're testing in, check their defaults (most generally ship at 16px) whatever the default setting is will be = to 1em - You simply can't fix font size, you can only suggest, because you can't be sure what everyones preferences are.

1) Can anyone tell me if I'm goofing up the Be Nice to Opera hack? (I've never needed this one before.)

That's not the "Be Nice to Opera Hack" - It's the "Tantek Box Model Hack" (which used to include an advanced selector rule in order to 'be nice to Opera' because Opera6 didn't like it) it only works for IE5.x and is now generally regarded as being superceded by the much simpler Simplified Box Model Hack (or Tan Hack) - Box Model Hacks [css-discuss.incutio.com] - either way it's an IE Only Hack!

2) Is there any way anyone knows to show CSS code just to FF, i.e., analogous to the two other hacks above?

Not without cloaking as JAB says, but there's not been much need for FF/Opera specific hacks for the last 3+ years!

Suzy

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved