Paolo Scamardella
Paolo Scamardella

Reputation: 245

CSS for Firefox and Safari on Mac OS?

This might be a stupid question, but I have a scenario where I fixed someone's webpage, and it is looking good on all major web browsers on my Windows machine. However, when I uploaded the website to Adobe BrowserLab, and when I looked at Safari and Firefox on a OS X, the footer is a bit off from Safari and FireFox on a Windows operating system.

My questions are:

Thank you people!

Upvotes: 1

Views: 6388

Answers (4)

Chillie
Chillie

Reputation: 1026

You can use JavaScript to target specific browsers but also operating systems for the browser.

http://www.javascriptkit.com/javatutors/navigator.shtml

Upvotes: 0

Rich Bradshaw
Rich Bradshaw

Reputation: 72965

Yes, but this is rarely the right approach. I'd imagine that it's a font issue - perhaps you are using a font that is only on Windows, or one where the OSX version is slightly different.

If you did want to do this, you could either use a server side language (for instance, PHP) to check the user agent, then include an extra style sheet, or use JS to add the styles using the same technique.

When researching this, any info on CSS hacks should be avoided at all costs.

This is a good way to do this: http://www.quirksmode.org/js/detect.html as it avoids hacks, and produces an easy to use object containing the relevant information.

I would only use this technique in dire situations - in all the sites I've ever made, I've never had to do this, other than for old IE and iOS.

Upvotes: 0

daan
daan

Reputation: 254

Best practice: Try to fix it without doing user agent detection. Analyze the problem, you could try to ask specific advice on your problem here. Especially Gecko and WebKit rendering engines behave almost exactly the same on each platform, bugs should be easy to squash.

If you really can't fix it, you can do JS browser detection, and include a CSS dynamically.

This is a bad practice however: whenever you make changes, you need to change each css for each browser.

Upvotes: 2

Dominic Green
Dominic Green

Reputation: 10258

You can target browsers specifically normally firefox chrome etc work roughly the same and ie may work slightly differently.

A way to target browsers is described here

http://www.webmonkey.com/2010/02/browser-specific_css_hacks/
http://reference.sitepoint.com/css/conditionalcomments

Upvotes: 1

Related Questions