Less programming CSS Learning

Source: Internet
Author: User

Some time ago, I took the time to learn less, a dynamic style language, and felt really powerful.

How to use it on the client:

1. Introduce your style file and set the rel attribute to stylesheet/less.

2. Introduce the less. js file you downloaded in the head.

Note: 1. The style file must be earlier than the less. js file. 2. It must be used in the server environment.

Usage:

1. Usage of variables.

Variables allow us to define a series of general styles separately and then call them when needed.

 
@ The-border: 2px solid # CCC;. de{Border:@ The-border;}

2. function method.

We can pass a parameter to it and call it like using a function.

. Box-shadow (@ shadow){Box-shadow:@ Shadow;}. De{Width:Pixel PX;Height:Pixel PX;. Box-shadow (#936 0 0 10px );}

3. nested mode.

We can nest another selector in one selector to implement inheritance.

 
. De{P {color:#936;}}

4. Functions and calculation methods.

ProgramAddition, subtraction, multiplication, division.

  @ the-border: 1px; @ The-color: #111 ;. de  { color : @the-color * 3 ;}

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.