summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeoff Liu <cangming.liu@gmail.com>2016-08-21 14:20:38 -0400
committerGitHub <noreply@github.com>2016-08-21 14:20:38 -0400
commit6d119f68d50d1c4aead60a2cbcf0f9a59c563280 (patch)
tree09ece9ecb7c0a29ffd41cef4762f9f92670225a2
parentb8891b5b31b245c321ca6a88a21ae74de1850169 (diff)
parentf6c353eb37b553ae18e659eb5b6eb883e43e4b00 (diff)
Merge pull request #2322 from tidupls/master
Fix inconsistencies and add resource links
-rw-r--r--less.html.markdown149
1 files changed, 79 insertions, 70 deletions
diff --git a/less.html.markdown b/less.html.markdown
index a1018ca3..d88b6ee9 100644
--- a/less.html.markdown
+++ b/less.html.markdown
@@ -24,8 +24,8 @@ Less (and other preprocessors, such as [Sass](http://sass-lang.com/) help develo
/* You can store a CSS value (such as a color) in a variable.
Use the '@' symbol to create a variable. */
-@primary-color: #A3A4FF;
-@secondary-color: #51527F;
+@primary-color: #a3a4ff;
+@secondary-color: #51527f;
@body-font: 'Roboto', sans-serif;
/* You can use the variables throughout your stylesheet.
@@ -39,7 +39,7 @@ body {
/* This would compile to: */
body {
- background-color: #A3A4FF;
+ background-color: #a3a4ff;
color: #51527F;
font-family: 'Roboto', sans-serif;
}
@@ -86,7 +86,7 @@ div {
margin-right: auto;
left: 0;
right: 0;
- background-color: #A3A4FF;
+ background-color: #a3a4ff;
}
/* You can omit the mixin code from being compiled by adding parenthesis
@@ -112,7 +112,66 @@ div {
margin-right: auto;
left: 0;
right: 0;
- background-color: #A3A4FF;
+ background-color: #a3a4ff;
+}
+
+
+/*Nesting
+==============================*/
+
+
+
+/*Less allows you to nest selectors within selectors */
+
+ul {
+ list-style-type: none;
+ margin-top: 2em;
+
+ li {
+ background-color: #f00;
+ }
+}
+
+/* '&' will be replaced by the parent selector. */
+/* You can also nest pseudo-classes. */
+/* Keep in mind that over-nesting will make your code less maintainable.
+Best practices recommend going no more than 3 levels deep when nesting.
+For example: */
+
+ul {
+ list-style-type: none;
+ margin-top: 2em;
+
+ li {
+ background-color: red;
+
+ &:hover {
+ background-color: blue;
+ }
+
+ a {
+ color: white;
+ }
+ }
+}
+
+/* Compiles to: */
+
+ul {
+ list-style-type: none;
+ margin-top: 2em;
+}
+
+ul li {
+ background-color: red;
+}
+
+ul li:hover {
+ background-color: blue;
+}
+
+ul li a {
+ color: white;
}
@@ -130,8 +189,12 @@ body {
width: round(10.25px);
}
+.header {
+ background-color: lighten(#000, 0.5);
+}
+
.footer {
- background-color: fadeout(#000000, 0.25)
+ background-color: fadeout(#000, 0.25)
}
/* Compiles to: */
@@ -140,6 +203,10 @@ body {
width: 10px;
}
+.header {
+ background-color: #010101;
+}
+
.footer {
background-color: rgba(0, 0, 0, 0.75);
}
@@ -155,12 +222,12 @@ body {
and return the percentage */
.average(@x, @y) {
- @average_result: ((@x + @y) / 2);
+ @average-result: ((@x + @y) / 2);
}
div {
.average(16px, 50px); // "call" the mixin
- padding: @average_result; // use its "return" value
+ padding: @average-result; // use its "return" value
}
/* Compiles to: */
@@ -202,67 +269,6 @@ div {
add unnecessary bloat to the files created by the Less compiler. */
-
-/*Nesting
-==============================*/
-
-
-
-/*Less allows you to nest selectors within selectors */
-
-ul {
- list-style-type: none;
- margin-top: 2em;
-
- li {
- background-color: #FF0000;
- }
-}
-
-/* '&' will be replaced by the parent selector. */
-/* You can also nest pseudo-classes. */
-/* Keep in mind that over-nesting will make your code less maintainable.
-Best practices recommend going no more than 3 levels deep when nesting.
-For example: */
-
-ul {
- list-style-type: none;
- margin-top: 2em;
-
- li {
- background-color: red;
-
- &:hover {
- background-color: blue;
- }
-
- a {
- color: white;
- }
- }
-}
-
-/* Compiles to: */
-
-ul {
- list-style-type: none;
- margin-top: 2em;
-}
-
-ul li {
- background-color: red;
-}
-
-ul li:hover {
- background-color: blue;
-}
-
-ul li a {
- color: white;
-}
-
-
-
/*Partials and Imports
==============================*/
@@ -365,7 +371,9 @@ body {
## Practice Less
-If you want to play with Less in your browser, check out [LESS2CSS](http://lesscss.org/less-preview/).
+If you want to play with Less in your browser, check out:
+* [Codepen](http://codepen.io/)
+* [LESS2CSS](http://lesscss.org/less-preview/)
## Compatibility
@@ -377,3 +385,4 @@ with your target browsers.
## Further reading
* [Official Documentation](http://lesscss.org/features/)
+* [Less CSS - Beginner's Guide](http://www.hongkiat.com/blog/less-basic/)