Breezeless focus on providing reusable LESS mixins and resolving complicated headaches in CSS coding.
- Easy to use. All the mixins in Breezeless start with bl- prefix, and keep their names the same as corresponding CSS properties as much as possible.
- No CSS output. All the mixins don’t output any CSS, thus, you can use these mixins inside your own LESS mixins, but you can’t use the bl- prefixed names as CSS classes in HTML.
- Cross-browser. Breezeless generates vendor-prefixed versions of a CSS property. Breezeless follows a rule to decide whether a vendor-prefixed CSS property should be added into a mixin. If the market share of any version of any kind of the browsers that need a vendor-prefix to support a specific CSS feature is equal to or greater than 0.02%, the vendor-prefix version CSS property will be used.(All the market share data is get from Can I use.)
- Merged properties. Breezeless solves special cases when a standard CSS property is supported but another CSS property name that is used as a parameter of the former CSS property is maybe not supported(need add vendor-prefix) in a browser. For instance, Chrome 35 supports transition, but doesn’t support transform(need add -webkit- vendor-prefix), with prue CSS, you need write transition: -webkit-transform 2s; in Chrome 35 and write transition: transform 2s; in the latest version of Chrome. Breezeless solves this problem in one line .bl-transition(transform 2s);.
- Helpes. Breezeless also provides some useful helpers to deal with common browser compatibility issues.
How to Use
- Download the breezeless.less file and place it in your working LESS folder.
- Reference breezeless.less in the top of your LESS files.
@import (reference) "breezeless.less";
Set border style property of an element. A complete border style consists three properties, they are width, style and color.
• When the length of arguments is less than or equral to 3, same style will be applied to all four borders. You can pass border width, border style and border color into the arguments individually, or passed a single value list combined of them to the mixin. The values of width style and color are optional, the mixin will apply a default value if you leave any of them empty.
.bl-border(2px); .bl-border(2px; #999); .bl-border(0 dashed #A87);
• When the length of arguments is 4, the four arguments represent top border, right border, bottom border and left border respectively, each argument is a value list which may consists border width, border style and border color. If one argument’s value is set to null, then no style will be applied to the relevant border.
.bl-border(6px; 3px; 1px; 2px); .bl-border(solid #FFF000; null; 3px dashed; 2px dotted #909090);
• Default values. By default, border width is set to 1px, border style is set to solid, and border color is set to #000.
// equivalent to .bl-border(6px solid #000; 1px solid #FF0; 1px dashed #000; 1px solid blue); .bl-border(6px; #FF0; dashed; blue);
The inline-block display fix. Fix to support inline-block display for IE6 and IE7.
Mixin for box-sizing CSS property.
.bl-box-sizing(); // default value: border-box .bl-box-sizing(border-box);
Mixin for user-select CSS property.
.bl-user-select(); // default value: none .bl-user-select(text);
CLear an element itself which contains floated children.
Set single or multiple shadows to one element.
//single shadow .bl-box-shadow(3px 3px 6px 2px rgba(0, 0, 0, 0.2)); //multiple shadows .bl-box-shadow(1px 1px 2px 0 #F00; inset -1px -1px 2px 0 #00F);
Set border-radius property of an element.
.bl-border-radius(e("60px 20px / 30px")); .bl-border-radius(10px);
Set opacity of an element, support IE6 and above.
• You can pass a number to the opacity argument.
• A percentage number is also valid.
Set single or multiple transitions to one element.
• BreezeLess defined five transition mixins, one mixin is used to set the shorthand transition property, and the other four are used to set specific transition CSS property. Each mixin accept one or more arguments.
• When you need to pass “transform” as the transition-property value, you don’t need to add vendor-prefixes before “transform”, BreezeLess will do it for you.
• bl-transition. Set the shorthand transition property.
.bl-transition(transform 1s); .bl-transition(width 2s; height 2s);
• bl-transition-property. Set transition-property property.
• bl-transition-duration. Set transition-duration property.
• bl-transition-timing-function. Set transition-timing-function property.
• bl-transition-delay. Set transition-delay property.
Set single or multiple animations to one element.
• BreezeLess defined nine transition mixins, one mixin is used to set the shorthand animation property, and the other eight mixins are used to set specific animation CSS property. Each mixin accept one or more arguments.
• bl-animation. Set the shorthand animation property.
.bl-animation(swing 3s ease 1s 2 alternate both running); .bl-animation(bounce 5s; rotate 2s);
• bl-animation-name. Set animation-name property.
• bl-animation-duration. Set animation-duration property.
• bl-animation-timing-function. Set animation-timing-function property.
• bl-animation-delay. Set animation-delay property.
• bl-animation-iteration-count. Set animation-iteration-count property.
• bl-animation-direction. Set animation-direction property.
.bl-animation-direction(alternate; reverse; alternate-reverse);
• bl-animation-fill-mode. Set animation-fill-mode property.
• bl-animation-play-state. Set animation-play-state property.
Display an ellipsis (‘…’, U+2026 HORIZONTAL ELLIPSIS) for a clipped text.
Set transform related CSS properties.
• bl-transform. Set the shorthand transform property.
• bl-transform-origin. Set transform-origin property.
• bl-transform-style. Set transform-style property.
• bl-perspective. Set perspective property.
• bl-perspective-origin. Set perspective-origin property.
• bl-backface-visibility. Set backface-visibility property.
To see more examples and references, you can check the breezeless source code.