1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-27 04:10:03 +01:00
blog/_src/assets/less/mixins.less

265 lines
6.8 KiB
Plaintext

/////////////////////////////////////
// MIXINS
/////////////////////////////////////
// Logo
/////////////////////////////////////
.logo {
display: block;
background-image: data-uri('../img/logo.png');
background-repeat: no-repeat;
background-position: center top;
height: 60px;
@media @highDPI {
background-image: url('../img/logo@2x.png');
background-size: 128px 120px;
}
}
// Dimmed Text
/////////////////////////////////////
.dimmed {
color: @text-color-dimmed;
p { color: @text-color-dimmed; }
li { color: @text-color-dimmed; }
}
// Text overflow
/////////////////////////////////////
.ellipsis {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden
}
// Dashed Dividers
/////////////////////////////////////
.divider-top,
.divider-bottom {
position: relative;
&:before {
content: "";
position: absolute;
left: 0;
height: 1px;
}
}
.divider-top {
border-top: 1px dashed #afc3cb;
padding-top: 1em;
&:after {
content: "";
position: absolute;
left: 0;
height: 1px;
top: 0;
width: 100%;
border-top: 1px dashed #fff;
}
}
.divider-bottom {
border-bottom: 1px dashed #afc3cb;
padding-bottom: 1em;
&:before {
bottom: -2px;
width: 100%;
border-bottom: 1px dashed #fff;
}
}
// Heading band
/////////////////////////////////////
.heading-band {
display: inline-block;
clear: both;
background: rgba(255,255,255,.55);
padding: @line-height-computed/2 @line-height-computed @line-height-computed/2 100%;
margin-left: -100%;
.border-right-radius(@border-radius-base);
}
/////////////////////////////////////
// CSS3 PROPERTIES
/////////////////////////////////////
// Border Radius
.border-radius(@radius: @border-radius-base) {
border-radius: @radius;
background-clip: padding-box;
}
// Single side border-radius
.border-top-radius(@radius) {
border-top-right-radius: @radius;
border-top-left-radius: @radius;
}
.border-right-radius(@radius) {
border-bottom-right-radius: @radius;
border-top-right-radius: @radius;
}
.border-bottom-radius(@radius) {
border-bottom-right-radius: @radius;
border-bottom-left-radius: @radius;
}
.border-left-radius(@radius) {
border-bottom-left-radius: @radius;
border-top-left-radius: @radius;
}
// Drop shadows
.box-shadow(@shadow) {
-webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
box-shadow: @shadow;
}
// Transitions
.transition(@transition: all .2s ease-in-out 0s) {
-webkit-transition: @transition;
transition: @transition;
}
.transition-delay(@transition-delay) {
-webkit-transition-delay: @transition-delay;
transition-delay: @transition-delay;
}
.transition-duration(@transition-duration) {
-webkit-transition-duration: @transition-duration;
transition-duration: @transition-duration;
}
.transition-property(@property) {
-webkit-transition-property: @property;
transition-property: @property;
}
// Animations
.animation(@animation) {
-webkit-animation: @animation;
animation: @animation;
}
.animation-delay(@delay) {
-webkit-animation-delay: @delay;
animation-delay: @delay;
}
// Transformations
.rotate(@degrees) {
-webkit-transform: rotate(@degrees);
-ms-transform: rotate(@degrees);
transform: rotate(@degrees);
}
.scale(@ratio) {
-webkit-transform: scale(@ratio);
-ms-transform: scale(@ratio);
transform: scale(@ratio);
}
.translate(@x, @y) {
-webkit-transform: translate(@x, @y);
-ms-transform: translate(@x, @y);
transform: translate(@x, @y);
}
.skew(@x, @y) {
-webkit-transform: skew(@x, @y);
-ms-transform: skewX(@x) skewY(@y); // See https://github.com/twitter/bootstrap/issues/4885
transform: skew(@x, @y);
}
.translate3d(@x, @y, @z) {
-webkit-transform: translate3d(@x, @y, @z);
transform: translate3d(@x, @y, @z);
}
// Backface visibility
// Prevent browsers from flickering when using CSS 3D transforms.
// Default value is `visible`, but can be changed to `hidden
// See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples
.backface-visibility(@visibility){
-webkit-backface-visibility: @visibility;
-moz-backface-visibility: @visibility;
backface-visibility: @visibility;
}
// Background clipping
.background-clip(@clip) {
-webkit-background-clip: @clip;
-moz-background-clip: @clip;
background-clip: @clip;
}
// Box sizing
.box-sizing(@boxmodel) {
-webkit-box-sizing: @boxmodel;
-moz-box-sizing: @boxmodel;
box-sizing: @boxmodel;
}
// User select
// For selecting text on the page
.user-select(@select) {
-webkit-user-select: @select;
-moz-user-select: @select;
-ms-user-select: @select;
user-select: @select;
}
// Resize anything
.resizable(@direction) {
resize: @direction; // Options: horizontal, vertical, both
overflow: auto; // Safari fix
}
// CSS3 Content Columns
.content-columns(@column-count, @column-gap: @grid-gutter-width) {
-webkit-column-count: @column-count;
-moz-column-count: @column-count;
column-count: @column-count;
-webkit-column-gap: @column-gap;
-moz-column-gap: @column-gap;
column-gap: @column-gap;
}
// Optional hyphenation
.hyphens(@mode: auto) {
word-wrap: break-word;
-webkit-hyphens: @mode;
-moz-hyphens: @mode;
-ms-hyphens: @mode;
hyphens: @mode;
}
// GRADIENTS
/////////////////////////////////////
#gradient {
// Horizontal gradient, from left to right
//
// Creates two color stops, start and end, by specifying a color and position for each color stop.
// Color stops are not available in IE9 and below.
.horizontal(@start-color: #555; @start-percent: 0%; @end-color: #333; @end-percent: 100%) {
background-image: -webkit-linear-gradient(left, color-stop(@start-color @start-percent), color-stop(@end-color @end-percent)); // Safari 5.1+, Chrome 10+
background-image: -moz-linear-gradient(left, @start-color @start-percent, @end-color @end-percent); // FF 3.6+
background-image: linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10
background-repeat: repeat-x;
}
// Vertical gradient, from top to bottom
//
// Creates two color stops, start and end, by specifying a color and position for each color stop.
// Color stops are not available in IE9 and below.
.vertical(@start-color: #555; @start-percent: 0%; @end-color: #333; @end-percent: 100%) {
background-image: -webkit-linear-gradient(top, @start-color, @start-percent, @end-color, @end-percent); // Safari 5.1+, Chrome 10+
background-image: -moz-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // FF 3.6+
background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10
background-repeat: repeat-x;
}
}