Skip to content

Instantly share code, notes, and snippets.

@amccloud
Created August 31, 2012 03:56
Show Gist options
  • Save amccloud/3548912 to your computer and use it in GitHub Desktop.
Save amccloud/3548912 to your computer and use it in GitHub Desktop.
@defaultModalZindex: 9999;
.border-radius(@radius) {
-webkit-border-radius: @radius;
border-radius: @radius;
}
.box-shadow(@shadow) {
-webkit-box-shadow: @shadow;
box-shadow: @shadow;
}
.box-sizing(@sizing) {
-webkit-box-sizing: @sizing;
-moz-box-sizing: @sizing;
box-sizing: @sizing;
}
.opacity(@opacity) {
filter: e(%("alpha(opacity=%d)", @opacity));
-khtml-opacity: @opacity / 100;
-moz-opacity: @opacity / 100;
opacity: @opacity / 100;
}
.transition(@transition) {
-webkit-transition: @transition;
-moz-transition: @transition;
-o-transition: @transition;
transition: @transition;
}
.user-select(@select) {
-webkit-user-select: @select;
-moz-user-select: @select;
user-select: @select;
}
.size(@width, @height) {
width: @width;
height: @height;
}
.size(@widthHeight) {
.size(@widthHeight, @widthHeight);
}
.square(@widthHeight) {
.size(@widthHeight);
}
.circle(@diameter) {
.square(@diameter);
.border-radius(@diameter / 2);
}
.image(@src, @width, @height) {
.size(@width, @height);
background-image: url(@src) no-repeat;
}
.image(@src, @widthHeight) {
.image(@src, @widthHeight, @widthHeight);
}
.position(@position, @top, @right, @bottom, @left) {
position: @position;
top: @top;
right: @right;
bottom: @bottom;
left: @left;
}
.position(@position, @top, @leftRight, @bottom) {
.position(@position, @top, @leftRight, @bottom, @leftRight);
}
.position(@position, @topBottom, @leftRight) {
.position(@position, @topBottom, @leftRight, @topBottom, @leftRight);
}
.position(@position, @topLeftBottomRight) {
.position(@position, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight);
}
.absolute(@top, @right, @bottom, @left) {
.position(absolute, @top, @right, @bottom, @left);
}
.absolute(@top, @leftRight, @bottom) {
.position(absolute, @top, @leftRight, @bottom, @leftRight);
}
.absolute(@topBottom, @leftRight) {
.position(absolute, @topBottom, @leftRight, @topBottom, @leftRight);
}
.absolute(@topLeftBottomRight) {
.position(absolute, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight);
}
.fixed(@top, @right, @bottom, @left) {
.position(fixed, @top, @right, @bottom, @left);
}
.fixed(@top, @leftRight, @bottom) {
.position(fixed, @top, @leftRight, @bottom, @leftRight);
}
.fixed(@topBottom, @leftRight) {
.position(fixed, @topBottom, @leftRight, @topBottom, @leftRight);
}
.fixed(@topLeftBottomRight) {
.position(fixed, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight);
}
.relative(@top, @right, @bottom, @left) {
.position(relative, @top, @right, @bottom, @left);
}
.relative(@top, @leftRight, @bottom) {
.position(relative, @top, @leftRight, @bottom, @leftRight);
}
.relative(@topBottom, @leftRight) {
.position(relative, @topBottom, @leftRight, @topBottom, @leftRight);
}
.relative(@topLeftBottomRight) {
.position(relative, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight, @topLeftBottomRight);
}
.-modal-base(@width, @height, @zIndex) {
& > * {
.absolute(50%);
.size(@width, @height);
margin-left: (@width / 2) * -1;
margin-top: (@height / 2) * -1;
z-index: @zIndex;
}
}
.-modal-mask(@maskBackground, @zIndex) {
&:before {
.size(100%);
background: @maskBackground;
content: "";
position: absolute;
z-index: @zIndex;
}
}
.modal(@width, @height, @maskBackground, @zIndex) {
.-modal-base(@width, @height, @zIndex);
.-modal-mask(@maskBackground, @zIndex - 1);
}
.modal(@width, @height, @maskBackground) {
.-modal-base(@width, @height, @defaultModalZindex);
.-modal-mask(@maskBackground, @defaultModalZindex - 1);
}
.modal(@width, @height) {
.-modal-base(@width, @height, @defaultModalZindex);
}
.modal(@widthHeight) {
.-modal-base(@widthHeight, @widthHeight, @defaultModalZindex);
}
.pull-left() {
float: left;
}
.pull-right() {
float: right;
}
.hide() {
display: none;
}
.show() {
display: block;
}
.invisible() {
visibility: hidden;
}
.group() {
*zoom: 1;
&:before, &:after {
content: "";
display: table;
line-height: 0;
}
&:after {
clear: both;
}
}
.clearfix() {
.group;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment