Topic: Cross Browser Css

Hi,
   I am making an application and I want to write different css for different browsers.I have slove this problem by writing linked css in comments for windows but now I have to write css for    safari also. so, Please tell me how can I call css for safari. I think javascript is needed for this task.

thanks in advanced.

Re: Cross Browser Css

Hi mahendra,

I don't have the solution for your problem, but mind if I ask what this would be good for? Are you planning on showing different page layouts for each browser or are you simply trying to fix/hack cross-browser issues?

When you are trying to fix/hack and need a CSS for every browser, then I think your CSS might not be valid. I did not come across a site so far that needs specific CSS for each browser to be displayed the same way in all of them.

If you are planning on displaying a different site layout for every browser I am sure there is a method in Rails to determine the current browser. You can then include the wanted CSS before the page gets rendered.

Re: Cross Browser Css

rudi I just want to fix/hack cross-browser issues. please help me

Last edited by mahendra (2007-06-20 08:31:19)

Re: Cross Browser Css

what problems do you have then? It would be helpful if you have the website online somewhere and say what goes wrong smile

Re: Cross Browser Css

I haven't heard of a safari hack yet for css errors. I know if you google for IE/Firefox/Opera you'll find hacks.

What fixes are you trying to make -- Rudi is right; each type of error requires a different solution because one fix may mess up another browser view.

matthewvb

Re: Cross Browser Css

The only safari hack Ive ever seen or used it the "trailing #" hack.

If you have css like this

#something {
color: red;
text-align: left; #
}

Safari will ignore everything (and I mean EVERYTHING) after the trailing #.

so you could do something like this to whow 2 different colors on mac safari and pc

#something {
color: red;
text-align: left; #
}
(the following will override the previous style on PC, but MAC wont see it)
#something {     
color: blue;
text-align: left;
}

I'd highly advise against using it, but if it is your only option then its your only option!