views:

148

answers:

1

This is for using in Safari, though it could probably be used on Firefox as well. In Chrome you have to add a plugin anyway (which generally allow for custom CSS per domain), and Opera already allows this to be done without needing any CSS. But while it's for customizing on the client-side, it's also a pure CSS question. So I'm using no plugins here.

So, again, I got a custom CSS code (easily) working for all domains. Now I want to get specify CSS code for each domain. All with just 1 CSS file that's being loaded by Safari.

Over the web and googling, I've found two ways to supposedly do this, but none actually worked. They're both documented on userstyles.com:

  • @-moz-document domain("your-domain.com") { }. This would be perfect, since I can have several tags like that and just choose which style will be loaded for which domain. It just doesn't work.

  • @namespace is quite confusing and I've tried every variation I could think of. None worked.

+1  A: 

have you tried setting a <link /> src dynamically based on the document.domain? If you're using javascript, that is. This will let you set the src of the link tag to mydomain.com.css or myotherdomain.com.css

hunter
I haven't tried this, but I'm not using javascript at all. Neither do I want to. ;)
Cawas