Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 18-06-2009
Member
 
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?
Reply With Quote
  #2  
Old 18-06-2009
Member
 
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/
Reply With Quote
  #3  
Old 18-06-2009
Member
 
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.
Reply With Quote
  #4  
Old 18-06-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 11:42 AM.