Use any CSS compiler (Sass, Less) to generate the selector

Posted by xckpd7 on Stack Overflow See other posts from Stack Overflow or by xckpd7
Published on 2010-04-30T19:38:14Z Indexed on 2010/05/01 2:57 UTC
Read the original article Hit count: 463

Filed under:
|
|
|
|

So I've recently been playing around with CSS compilers, but I have no idea how (or if it's possible) to dynamically generate pieces of a selector.

For instance, let's say I wanted to make mixins to get

display: inline-block; 

to work cross browser. I would have to do the styles, yeah, but I would have to do the IE6/7 selector hacks to get them to work in those browsers too. Ideally I'm looking for a one off thing to add to an element and have the ability for that to work. Some kind person recently gave me this solution: http://stackoverflow.com/questions/2746754/css-compilers-and-converting-ie-hacks-to-conditional-css/2747036#2747036

and it would be nice to implement that in a minimal way that would allow me to specify it for a given element and be on my way (for instance in Less, you can create a class with styles, pass that class to another element, and that element will inherit all of those styles. It would be nice to pass an element .inline-block; and it create the styles needed to support IE6/7 without having to resort to stuff like

_color: pink; 

Any ideas?

EDIT: for instance as well, how could I do something like clearfix for LESS? (lesscss.org)? If Sass can only do it then that will work too.

© Stack Overflow or respective owner

Related posts about css

Related posts about sass