#Stylus center mixin
A simply mixin to center elements with stylus
##Usage
You can call the mixin with no params and it will center the element automaticly
// Stylus sintaxis
.element
-center()
// CSS output
.element {
margin-left: auto;
margin-right: auto;
}
Yo can also center elements and give them vertical margins by using "top" or "bottom" and the value
// Stylus sintaxis
.element
-center top 20
// CSS output
.element {
margin-top: 20px;
margin-left: auto;
margin-right: auto;
}
If you want to give diferent values to the top and bottom margins you can use "vertical" andtwo values. The first one will be asign to the top margin and the next one to the bottom margin
// Stylus sintaxis
.element
-margin vertical 40 20
// CSS output
.element {
margin-top: 40px;
margin-bottom: 20px;
margin-left: auto;
margin-right: auto;
}
You can also asign a width value
// Stylus sintaxis
.element
-margin width 80%
// CSS output
.element {
width: 80%;
margin-left: auto;
margin-right: auto;
}
Sencillo pero útil