PDA

Click to See Complete Forum and Search --> : design for all browsers & Javascript browser detection


xc-runner
08-11-2008, 04:15 PM
Howdy folks,

Ive just made a site and it appears it looks fine in FF and IE on a pc but a few small errors in Safari on a mac.

What's the best technique to approach this, I was thinking use JS to detect the browser and use an alternative style sheet or maybe just make inline changes.

any other ideas?

i use things like style=" margin blah blah and #magrin blah blah to fix between FF and IE, but is there a third for Safari?

Thanks

hewligan
08-12-2008, 04:55 AM
Browser detection is really a weapon of absolute last resort.

It's an unreliable, ugly hack that tends to break completely when the next browser release happens - which is fairly frequently. To say nothing of the minor browsers you won't have tested on at all.

Without knowing the specific problems you're running into, it's hard to advise you on solutions, but browser detection scripts are rarely a good answer.

(Though I may have been forced to use them once or twice myself - but it made me feel dirty :( )

tZ
08-12-2008, 05:01 AM
Seconded, you should always try to correct the problem rather than treat the symptom.

snaxnz
08-12-2008, 05:04 AM
inline CSS hacks work fine for me:

*+html .yourSelector {} will target IE7
*html .yourSelector {} will target IE6
html>/**/body .yourSelector, x:-moz-any-link, x:default {} will target FF3
@media screen and (-webkit-min-device-pixel-ratio:0) {.yourSelector {}} will target Safari 3 and Opera

plenty of CSS hack resources out there... just google it