2

I know that this is extremely unlikely to get the response I am looking for but I was looking for some sort of hack that would allow me to change the CSS on chrome JUST on MAC and not Windows.

I am working on a large Java/JSP product and have very limited access to change the HTML so I HAVE to position a single element using a margin(s).

I have used some CSS hacks to get the position pixel perfect on FF, IE 7,8,9, and 10, WIN Chrome, Opera and Safari however on MAC Chrome and MAC Safari it is a few pixels out.

I am really hoping I don't need to use some JavaScript to check the user agent string and change the margin that way but needs must.

Am I missing another CSS hack here?

Kara
  • 6,115
  • 16
  • 50
  • 57
Phish
  • 774
  • 3
  • 11
  • 27
  • 1
    I'd be really surprised if Chrome was treating margins differently to other browsers. You might want to post a question with an example of the problematic code, asking how you can get it to work cross-browser without hacks. – Paul D. Waite Oct 25 '13 at 09:22

2 Answers2

5

Unfortunately you can't do it without js. Some simple code from Chris Coyier:

if (navigator.userAgent.indexOf('Mac OS X') != -1) {
  $("body").addClass("mac");
} else {
  $("body").addClass("pc");
}

http://css-tricks.com/snippets/javascript/test-mac-pc-javascript/

Mihey Egoroff
  • 1,542
  • 14
  • 23
2

I don't think you can do this with CSS, it looks like JavaScript might be your only option.

What problem are you actually having with Chrome on Mac? You might not need to target specific browsers/operating systems, post your problematic code and we might be able to give you some CSS that will work cross-browser and operating system.

tomsullivan1989
  • 2,760
  • 14
  • 21