Using “If” In CSS: Conditional-CSS
12
Aug
Using different CSS properties for different browsers is very common as they are not rendered the same.
Conditional-CSS allows you to use "if statements" for targeting specific browser versions or a group of browsers.
Features of Conditional-CSS:
- Target CSS to any web-browser
- Streamline maintenance of your CSS files
- Optimise your CSS
- Work around those annoying little CSS bugs
- Automatic expansion and inclusion of @import statements
- It’s free and open source!
Website has an online compiler that enables you to generate the Conditional-CSS file in PHP, C or C#.
Website: http://www.conditional-css.com/
Demo: http://www.conditional-css.com/demo/
Download: http://www.conditional-css.com/download
Demo: http://www.conditional-css.com/demo/
Download: http://www.conditional-css.com/download
- Tags:
C# Php
- Filed under: Design, Other License, Xhtml & Css















7 Responses for "Using “If” In CSS: Conditional-CSS"
conditional comments already do this, and if you really need ifs inside your css, why not use php? neither of those options require you to install software on your server.
I gotta think that conditional CSS is like reinventing the wheel and all together more pointless but there are bound to be some “Conditional Fanbois” out there that will tell me I am missing the point or just “don’t get it”.
Well, that was my $0.02 (£0.04 after an extortionate amount of tax levied by the UK Government)
Amen to Dan. Plus, if you use an alternate style sheet just for IE6 (which should be the only thing you need it for), you will save on dl time for other browsers.
This seems like the lazy way out of learning to write good css. Like john said you should only need a new style sheet for ie6. And very very seldome one for ie7. But still pretty cool none the less.
Yep to John and Dan.
I tried this once and ended up with severe cpu use by my browser after adding a large number (hundreds) of elements to the page which had to be parsed by the javascript in the css above.
Please, avoid; it just bad design and took me an eternity to diagnose as the problem.
I didn’t really elaborate above.. but to those who don’t realize it the ‘expressions’ above that provide the conditional statements are actually javascript.
Why would you ever put javascript inside css especially when it can easily be CASCADED to MANY html tags on the page without you even realizing? It has disaster written all over it. You may get away with doing it for a while… but it eventually bites you in the rear.