Sass: The use of primary knowledge Sass and Koala tools

Source: Internet
Author: User

First, download Koala(Find the appropriate system version) and install

Second, create a new CSS folder and create a new text document (. txt) init and name it demo.scss

Third, open the koala, the CSS folder dragged in, you can modify the output mode

The extensions Sass provides four compile-style options :

    • Nested: Nested indentation of the CSS code, which is the default value.
    • Expanded: No indented, extended CSS code.
    • Compact: A concise form of CSS code.
    • Compressed: Compressed CSS code.

Four, it is time to write code, just use a text writing tool to open demo.scss

1.CSS style writing

1 ul Li a {2    color: red;  3 }

You will see the automatic generation of 2 files after saving (if:Koala software does not close)

2. In the Demo.scss Sass Style write the above CSS code

ul{    li{        a{            color:black;        }    }

Modify and save, at this point, we see the generated DEMO.CSS code is the same

If we want to write a CSS like this:

UL li a:hover {  color:blue;}

The corresponding sass can be:

ul{    li{        a{            color:black;             &: hover{                color:blue;     }}}

"Commentary"& represents an alternative element itself, in this case a

3. Use variables: All variables start with $

Write the following code in DEMO.SCSS:

$color: #abc; a{    color: $color;}

After saving, compile into the CSS:

{  color: #abc;}

V. The code written today

= = Demo.scss = =

= = Demo.css = =

Sass: The use of primary knowledge Sass and Koala tools

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.