Grouped examples, cleaned up whitespace

This commit is contained in:
Josh Sherman 2013-01-27 11:06:14 -05:00
parent dcd2d1eb9d
commit 194a8241db

102
README.md
View file

@ -7,94 +7,106 @@ More information and usage examples over at: <http://lesselements.com>
Examples page of all the mixins here: <http://lesselements.com/tests> Examples page of all the mixins here: <http://lesselements.com/tests>
Oreolek has a good fork with the mixins organized under namespaces here: https://github.com/Oreolek/elements Oreolek has a good fork with the mixins organized under namespaces here: https://github.com/Oreolek/elements
I recommend going with that if you use other frameworks like Bootstrap to avoid clashes. I recommend going with that if you use other frameworks like Bootstrap to avoid clashes.
TextMate bundle: <https://github.com/juanghurtado/less-elements.tmbundle> TextMate bundle: <https://github.com/juanghurtado/less-elements.tmbundle>
Ruby gem to work with Rails: <https://github.com/krasnoukhov/lesselements-rails> Ruby gem to work with Rails: <https://github.com/krasnoukhov/lesselements-rails>
License: This work is dedicated to the public domain and is free for all uses, commercial or otherwise. No form of credit required. License: This work is dedicated to the public domain and is free for all uses, commercial or otherwise. No form of credit required.
Mixins Mixins
------ ------
### Backgrounds
.background-clip(padding-box)
Sets the background-clip.
.gradient(#F5F5F5, #EEE, #FFF); .gradient(#F5F5F5, #EEE, #FFF);
Gradient background. First color is the background color to use for browsers that don't support gradients. The second two colors are the start and stop colors, going from bottom to top. Gradient background. First color is the background color to use for browsers that don't support gradients. The second two colors are the start and stop colors, going from bottom to top.
.bw-gradient(#EEE, 230, 255); .bw-gradient(#EEE, 230, 255);
Greyscale gradient background. Three values to set here. First one provides a color to use as a background for older browsers that don't support gradient backgrounds. Second and third values are the start and end brightness which goes from 0 to 255. Greyscale gradient background. Three values to set here. First one provides a color to use as a background for older browsers that don't support gradient backgrounds. Second and third values are the start and end brightness which goes from 0 to 255.
### Borders
.debug(red, 1px solid)
Adds a border for debugging purposes.
.bordered(#EEE, #E5E5E5, #DDD, #E5E5E5); .bordered(#EEE, #E5E5E5, #DDD, #E5E5E5);
Quick way to set a 1 pixel thick border that varies its color on each side. The color values go in a clockwise order: top, right, bottom, left. Quick way to set a 1 pixel thick border that varies its color on each side. The color values go in a clockwise order: top, right, bottom, left.
.drop-shadow(0, 1px, 2px, 0.2);
Adds a box-shadow that is a semi-transparent black. The first two values control the x and y axis position, the third controls blur (how big the shadow is), and the final value is the opacity (0 is fully transparent, 1 is opaque).
.rounded(5px); .rounded(5px);
Sets a border-radius for all 4 corners. If you want to set border-radius for individual corners use: .border-radius Sets a border-radius for all 4 corners. If you want to set border-radius for individual corners use: .border-radius
.border-radius(5px, 0, 0, 5px); .border-radius(5px, 0, 0, 5px);
Sets a border-radius for each of the 4 corners individually. The values go in a clockwise rotation: top right, bottom right, bottom left, top left. Sets a border-radius for each of the 4 corners individually. The values go in a clockwise rotation: top right, bottom right, bottom left, top left.
.opacity(0.8); ### Shadows
Sets the opacity. 0 is fully transparent, 1 is opaque.
.transition-duration(0.2s); .drop-shadow(0, 1px, 2px, 0.2);
Sets a transition-duration (time it takes to do things like hover effects). The value provides a time in seconds. Adds a box-shadow that is a semi-transparent black. The first two values control the x and y axis position, the third controls blur (how big the shadow is), and the final value is the opacity (0 is fully transparent, 1 is opaque).
.transform(...)
Sets the transform property.
.rotation(15deg);
Rotates the item by a number of degrees clockwise.
.scale(2);
Scales the item by the ratio provided. The example makes the item 2 times larger.
.transition(2s, ease-out);
Sets the transition duration and effect to use for any transitions (e.g. hover effects), unlike transition-duration which only sets the duration.
.inner-shadow(0, 1px, 2px, 0.4);
Sets the inner shadow. The first two numbers are the x and y coordinates, the third is the blur and the last one is the strength of the shadow.
.box-shadow(0 1px 2px #999); .box-shadow(0 1px 2px #999);
Sets the box-shadow. The first two numbers are the x and y coordinates, then the blur, and the color. This is different from drop-shadow in that it takes on a color instead of setting a transparent black shadow. Additionally, this mixin takes on the whole set of arguments in one go, so no need for commas between each number, and you can also add "inset" before the first number for inset shadow. Sets the box-shadow. The first two numbers are the x and y coordinates, then the blur, and the color. This is different from drop-shadow in that it takes on a color instead of setting a transparent black shadow. Additionally, this mixin takes on the whole set of arguments in one go, so no need for commas between each number, and you can also add "inset" before the first number for inset shadow.
.columns(250px, 0, 50px, #EEE, solid, 1px); .inner-shadow(0, 1px, 2px, 0.4);
Divides the content into columns. The variables are: column width, column count, column gap, column border color, column border style, column border width. Sets the inner shadow. The first two numbers are the x and y coordinates, the third is the blur and the last one is the strength of the shadow.
### Transitions
.transition(2s, ease-out);
Sets the transition duration and effect to use for any transitions (e.g. hover effects), unlike transition-duration which only sets the duration.
.transition-duration(0.2s);
Sets a transition-duration (time it takes to do things like hover effects). The value provides a time in seconds.
### Transformations
.rotation(15deg);
Rotates the item by a number of degrees clockwise.
.transform(...)
Sets the transform property.
.scale(2);
Scales the item by the ratio provided. The example makes the item 2 times larger.
.translate(10px, 20px); .translate(10px, 20px);
Translates an element using the given coordinates. The values are x and y offset coordinates, so the above example moves the element right 10 pixels and up 20 pixels. Translates an element using the given coordinates. The values are x and y offset coordinates, so the above example moves the element right 10 pixels and up 20 pixels.
### Miscellaneous
.box-sizing(content-box); .box-sizing(content-box);
Allows you to alter the CSS box model. For example, by setting this to 'border-box' the width and height properties will include the padding and border values. More info at MDN. Allows you to alter the CSS box model. For example, by setting this to 'border-box' the width and height properties will include the padding and border values. More info at MDN.
.columns(250px, 0, 50px, #EEE, solid, 1px);
Divides the content into columns. The variables are: column width, column count, column gap, column border color, column border style, column border width.
.opacity(0.8);
Sets the opacity. 0 is fully transparent, 1 is opaque.
.user-select(none); .user-select(none);
Allows you to disable text highlighting, which can be useful on interface elements. Allows you to disable text highlighting, which can be useful on interface elements.
.background-clip(padding-box)
Sets the background-clip.
.debug(red, 1px solid)
Adds a border for debugging purposes.