Less CSS IE targeting?

What is the best way to target IE7, 8, etc. In LESS?

Is there a way to target them or should I ideally need to download a separate stylesheet?

+5
source share
3 answers

As far as I know, LESS doesn’t allow you to target specific browsers, but only media sizes.

You need to do something like:

<!--[if IE]> <link rel="stylesheet/less" type="text/css" href="ie.less" /> <![endif]--> 
+3
source

Using the IE orientation method in Paul Irish allows your IE rules to take full advantage of the nesting in your main smaller file. http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

+2
source

Using the Paul Ireland technique that Scott Simpson also linked, you can easily include target selectors right next to the rest of your CSS. For instance:

 div { display: inline-block; .ie-8 & { zoom: 1; display: inline; } } 

Compiled CSS will be as follows:

 div { display: inline-block; } .ie-8 div { display: inline; zoom: 1; } 

I believe this method is preferable to split style sheets, because it’s easier to keep track of your IE-specific CSS.

+2
source

Source: https://habr.com/ru/post/1442114/


All Articles