Results 1 to 2 of 2

Thread: Css conditionals

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default Css conditionals

    Hi,

    I have a css file, and I want to have seperate style fore different browsers, like this:

    if (opera)
    color:red;
    if (firefox)
    color:black;
    if (IE)
    color: white;
    else
    color: green;
    How can I do it?

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    You'll have to go for the browser specific CSS hacks if you are looking for a CSS only solution. But using CSS hacks is not a good method though the developers use it to troubleshoot some issues in some specific browsers, mostly in IE.

    In most of the browsers these kind of CSS hacks can be done. Also most kind of CSS hacks works in a cross-browser manner. Some of the CSS hacks used in Firefox will work correctly in Google Chrome, Apple Safari, etc. Some does not. It will really difficult to identify the unique CSS hack for different browsers.

    But the operations that you've mentioned can be done through JS without much trouble though.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •