View Full Version : Windows XP specific CSS

Jan 29th, 2011, 10:11 AM
I want to create a separate stylesheet for users running Windows XP. Is there a way to do it? I just want to assign a different font family to Windows XP users. I have seen codes in which you have different stylesheet for OSX and Windows. But I would like it to be Win XP only. I tried looking around the web but couldn't find anything on it.

Jan 29th, 2011, 06:21 PM
Hello fase_xi,
I'm not sure at all how you would do that since the browser is what's running your code, not the OS. Windows XP can run everything from IE6 and lower, to the latest IE9 as well as any other browser.

Conditional Comments (http://www.quirksmode.org/css/condcom.html) usually target specific versions of IE, not the OS.

Jan 30th, 2011, 07:20 AM
Hello Excavator,
Well, my problem is basically the way Chrome and Firefox on WinXP (higher versions of Windows seems fine) render Droid Serif (a Google Font). In IE7 and higher, I find the rendering acceptable. IE6 is pretty bad but at least it's legible. But in Chrome and Firefox, the text is hardly legible. If the user has Cleartype turned on, everything would be fine but most don't. That's why I want to assign a default system font, such as Georgia or Arial, to WinXP users only, so it doesn't effect everything else.

Jan 30th, 2011, 11:45 AM
The OS information can be found in navigator.appVersion. You'd have to find out what the exact output is for the OS you're trying to target.

I just tried it in an emulated XP, and there it's Widows NT 5.1, so

if (navigator.appVersion.match('Windows NT 5.1')) {
// Put your style changes here
could work.

Of course, you'd have to use Javascript for that. There's no conditional comment for OS sniffing.

Feb 2nd, 2011, 03:33 PM
Got it working now. Many thanks.