Results 1 to 4 of 4

Thread: Condition for CSS to load for different browsers?

  1. #1
    Join Date
    May 2008
    Posts
    38

    Condition for CSS to load for different browsers?

    Hi,

    I want to put condition on my css file. Is it possible?
    Is there any way I can make a condition to check the browser & load the css property accordingly?

    Pleas help me if it is possible?

  2. #2
    Join Date
    May 2008
    Posts
    31

    Re: Condition for CSS to load for different browsers?

    Conditional-CSS example
    Code:
         
       a.button_active, a.button_unactive {  
       display: inline-block;  
       [if lte Gecko 1.8] display: -moz-inline-stack;  
       [if lte Konq 3.1] float: left;  
       height: 30px;  
       [if IE 5.0] margin-top: -1px;  
         
       text-decoration: none;  
       outline: none;  
       [if IE] text-decoration: expression(hideFocus='true');  
       }
    As you have seen above it is possible to put condition in your css. But is really not a recommended. But still if you really need to do so for different web browsers & optimizing your CSS file then you can do so.

    if you need more information & compiler for the same please visit the following website.
    http://www.conditional-css.com/

  3. #3
    Join Date
    May 2008
    Posts
    39

    Re: Condition for CSS to load for different browsers?

    Conditional comments only work in Explorer on Windows
    They are supported from Explorer 5 onwards, and it is even possible to distinguish between 5.0, 5.5 and 6.0.
    Syntax:
    Code:
    <!--[if IE 6]>
    Special instructions for IE 6 here
    <![endif]-->
    Their basic structure is the same as an HTML comment (<!-- -->). Therefore all other browsers will see them as normal comments and will ignore them entirely. Since conditional comments use the HTML comment structure, they can only be included in HTML files, and not in CSS files.
    You can also put an entire new <link> tag in the conditional comment referring to an extra style sheet.

  4. #4
    Join Date
    Jun 2009
    Posts
    7

    Re: Condition for CSS to load for different browsers?

    Only IE6+/Windows supports conditional comments. You can not use conditional comments in the css file.
    Don't forget to test your conditional CSS on different browsers other than Internet explorer such as Firefox, Opera, Safari, Google chrome etc.

Similar Threads

  1. Firefox 12 cannot load some websites but other Browsers can
    By Ramesha Bhattacharya in forum Technology & Internet
    Replies: 3
    Last Post: 26-04-2012, 06:31 PM
  2. C/C++ code for this condition.
    By eiijae19 in forum Software Development
    Replies: 1
    Last Post: 06-10-2011, 11:46 AM
  3. Pages never load on Opera, Firefox, Chrome, and IE browsers
    By Cheapstake in forum Technology & Internet
    Replies: 6
    Last Post: 24-06-2011, 10:23 PM
  4. Firefox 4 unable to load websites but IE and other browsers can
    By BaBHUshA in forum Technology & Internet
    Replies: 5
    Last Post: 14-04-2011, 11:06 AM
  5. if Condition in HTML
    By Ettan in forum Software Development
    Replies: 1
    Last Post: 14-10-2008, 05:48 PM

Tags for this Thread

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
  •  
Page generated in 1,714,031,939.03635 seconds with 16 queries