12.6-1211 Summary

Source: Internet
Author: User

Less
Declare first, then reference
Variable:
@ Name: Value
For example:
@nice-blue: #5B83AD;
@light-blue: @nice-blue + #111;
#header {color: @light-blue;}

Output #header {color: #6c94be;}
If the same variable is defined two times, the last defined in the current scope will be used. This is similar to the mechanism of CSS, where the last defined value becomes the value of this property.
# # # #混合:
. Name: Value
In less we can define some common set of properties as one class, and then call these properties in another class, such as:
. bordered {
border-top:dotted 1px black;
Border-bottom:solid 2px Black;
}
If we now need to introduce those common attribute sets in other classes, we just need to call them in any class like this:
#menu a {
Color: #111;
. bordered;
}
. Post a {
color:red;
. bordered;
}
The attribute styles in the. Bordered class will be reflected in #menu a and. Post a:
#menu a {
Color: #111;
border-top:dotted 1px black;
Border-bottom:solid 2px Black;
}
. Post a {
color:red;
border-top:dotted 1px black;
Border-bottom:solid 2px Black;
}
Mixed with parameters:
. Border-radius (@radius) {
Border-radius: @radius;
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
}
Multi-parameter blending:
. Name (@ name): value
Scope:
The scopes in less are very similar to other programming languages, starting with a local lookup of a variable or a hybrid module, and if not found, it goes to the parent scope until it is found.

12.6-1211 Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.