This is great. I maintain a LESS mixin library myself with a css3 library, but didn’t include text-shadow as I felt it was only one line anyway and wouldn’t benefit from having a mixin. But I guess by including it you were able to have a text-shadow with default values. Was this your rationale?
Some thoughts for compatibility between gradients (including transparency) and IE6-8:
Using an adapted mixin in conjunction with using Paul Irish’s infamous class based IE selectors (so that .ie6, .ie7, .ie8 classes are applied to either the HTML or body elements) you could hack in support without too much effort.
I suppose you could also use conditional stylesheets, though that’d be a lot longer way round the circle and something I haven’t done in a long while.
I’m wondering about the opacity mixin: What’s the reason for using vendor prefixes. They seem to be unnecessary. See http://caniuse.com/#search=opacity
I use the following opacity mixin in my base.less file:
Its great to have the box-sizing mixin. Other sets I’ve seen havent included it.
Going to town resetting a less file for my genesis theme. Thanks for making me feel SMARTER today…
Out of all the mixin sets i checked out today, this one is by far the best one. It’s not overly cluttered with things i will never (ever!) use, it contains just about everything i’ll need and it’s very nicely done. Thanks for the link!
I’m having problem when creating an mixing for box-shadow. My one is the same of yours, so I presume you passed by the same problem.
When using multiple box-shadows (comma separated) in one element (like ’2px 2px 3px 4px #000, inset -2px 1px 1px 0 #000′). LessCSS don’t compile and gives an error.
There is a way to go around this? I mean, to treat the value as a string or something else.
Thanks!!
Is there a way to write multiple transition with the .transition() mixin?
I’m trying to find how to make a mixin with undefined number of arguments and put all inside the rules with @arguments special variable.
background: -webkit-gradient(linear, left top, left bottom, from(@startColor), to(@endColor));
background: -webkit-linear-gradient(top, @startColor, @endColor);
Of the two, the second one is the one Webkit now recognizes (as well as Firefox and the Spec) correct? If so, which browsers only support the former version?
Beautiful. And completely useful, thanks!
In conjunction with my LESS DSS it will become a very good set of ‘less mixins’ :-)
Good work!
This is great. I maintain a LESS mixin library myself with a css3 library, but didn’t include text-shadow as I felt it was only one line anyway and wouldn’t benefit from having a mixin. But I guess by including it you were able to have a text-shadow with default values. Was this your rationale?
Some thoughts for compatibility between gradients (including transparency) and IE6-8:
Using an adapted mixin in conjunction with using Paul Irish’s infamous class based IE selectors (so that .ie6, .ie7, .ie8 classes are applied to either the HTML or body elements) you could hack in support without too much effort.
I suppose you could also use conditional stylesheets, though that’d be a lot longer way round the circle and something I haven’t done in a long while.
The RGBa to HEX function built into LESSPHP ensures that when you pass a RGBa value to the variable argument it is correctly converted for the proprietary MS CSS filter (using alpha hex, #AARRGGBB).
I've got to test the code yet, but it's an idea. Any thoughts?
That would be awesome. However, far as I can tell, LESS doesn’t allow for multiple selectors in mixin names.
Yeah a simple thought that could be done using nesting and ampersands, so:
I haven’t tested this either :O
Aww the preview didn’t match the result, take two:
Not sure if you guys have heard of it but there’s a great pack of mixins an such that the twitter bootstrap was built off of.
these would look muuuuuuch nicer as stylus :)
Thanks for sharing. Nice set of Mixins.
I’m wondering about the opacity mixin: What’s the reason for using vendor prefixes. They seem to be unnecessary. See http://caniuse.com/#search=opacity
I use the following opacity mixin in my base.less file:
Great LESS compiler for Windows and Linux for free :
http://wearekiss.com/simpless
No need .border-radiuses().
If you need to call custom border radius, just call..
:)
Its great to have the box-sizing mixin. Other sets I’ve seen havent included it.
Going to town resetting a less file for my genesis theme. Thanks for making me feel SMARTER today…
It’s radii not radiuses, haha
LESS Elements is a set of useful mixins for the LESS http://lesselements.com/
On GitHub https://github.com/dmitryf/elements
TextMate Bundle https://github.com/juanghurtado/less-elements.tmbundle
Out of all the mixin sets i checked out today, this one is by far the best one. It’s not overly cluttered with things i will never (ever!) use, it contains just about everything i’ll need and it’s very nicely done. Thanks for the link!
LESS !! please give me less css code of a web page, to my email. i am begaineer. it will be help full to me.
for the lazy ;)
.gradientAuto (@color: #000, @coef: 5%){ background: lighten(@color, @coef); /* Old browsers */ background: -moz-linear-gradient(top, lighten(@color, @coef) 0%, darken(@color, @coef) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,lighten(@color, @coef)), color-stop(100%,darken(@color, @coef))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, lighten(@color, @coef) 0%,darken(@color, @coef) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, lighten(@color, @coef) 0%,darken(@color, @coef) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, lighten(@color, @coef) 0%,darken(@color, @coef) 100%); /* IE10+ */ background: linear-gradient(to bottom, lighten(@color, @coef) 0%,darken(@color, @coef) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='lighten(@color, @coef)', endColorstr='darken(@color, @coef)',GradientType=0 ); /* IE6-9 */ }I’m having problem when creating an mixing for box-shadow. My one is the same of yours, so I presume you passed by the same problem.
When using multiple box-shadows (comma separated) in one element (like ’2px 2px 3px 4px #000, inset -2px 1px 1px 0 #000′). LessCSS don’t compile and gives an error.
There is a way to go around this? I mean, to treat the value as a string or something else.
Thanks!!
The comma separates the variables
use this ;)
.box-shadow-double (@string, @string2) { -webkit-box-shadow: @string, @string2; -moz-box-shadow: @string, @string2; box-shadow: @string, @string2; }Is there a way to write multiple transition with the .transition() mixin?
I’m trying to find how to make a mixin with undefined number of arguments and put all inside the rules with @arguments special variable.
<
p>I’ve just find how!
From LESS version 1.3.1 they’ll introduce a new special variable @arguments-list that will take arguments as a raw string. Here’s the usage:
.transition(...) {
-moz-transition: @arguments-list;
-webkit-transition: @arguments-list;
-o-transition: @arguments-list;
-ms-transition: @arguments-list;
transition: @arguments-list;
}
The ‘…’ means “don’t know how much arguments you’ll pass to my mixin, take ‘em all” ;)
background: -webkit-gradient(linear, left top, left bottom, from(@startColor), to(@endColor));
background: -webkit-linear-gradient(top, @startColor, @endColor);
Of the two, the second one is the one Webkit now recognizes (as well as Firefox and the Spec) correct? If so, which browsers only support the former version?
An excellent replacement for box-shadow LESS mixin
by http://www.toekneestuck.com/blog/2012/05/15/less-css-arguments-variable
It can easily replace those three ;-)
Here is a working example of using LESS mixins with Bootstrap : bit.ly/VzonQH
Firefox doesn’t like
0for delay value. You have to add units:0sBug 662171
So you should update to
.animation (@name, @duration: 300ms, @delay: 0s, @ease: ease) {Made a quick one for User Select.
.user-select (@val) { -webkit-touch-callout: @val; -webkit-user-select: @val; -khtml-user-select: @val; -moz-user-select: @val; -ms-user-select: @val; user-select: @val; }Thanks, i’m using in my projects ;)