The sass syntax used is:
sass --watch test.scss:test.css --style compact --style expanded
As shown below:
1 Custom variable
test.scss content is:
<span style="color: #000000;">$color: black; .test1 { background-color: $color; } </span>
The content compiled into test.css is:
<span style="color: #000000;">.test1 { background-color: black; }</span>
2 Add variables to the string
test.scss content is:
<span style="color: #000000;">$left: left; .test2 { border-#{$left}:1px #000 solid; }</span>
The content compiled into test.css is:
<span style="color: #000000;">.test2 { border-left: 1px #000 solid; }</span>
3 Add, subtract, multiply and divide within the pattern (pay attention to writing division)
test.scss content is:
<span style="color: #000000;">$para:4; .test3 { height: 5px+3px; width: (14px/7); right: $para*4; }</span>
The content compiled into test.css is:
<span style="color: #000000;">.test3 { height: 8px; width: 2px; right: 16; }</span>
4 sub-element writing
test.scss content is:
<span style="color: #000000;">.test4 { .lala { color: pink; } }</span>
The content compiled into test.css is:
<span style="color: #000000;">.test4 .lala { color: pink; }</span>
5 Inheritance (SASS allows one selector to inherit another selector)
test.scss content is:
<span style="color: #000000;">.class1 { border-left: 1px #000 solid; } .class2 { @extend .class1; font-size: 15px; }</span>
The content compiled into test.css is:
<span style="color: #000000;">.class1, .class2 { border-left: 1px #000 solid; } .class2 { font-size: 15px; }</span>
6 Reuse code blocks
The content of test.scss is: (no variables)
<span style="color: #000000;">@mixin test6 { height: 5px; left: 20px; top: 10px; } .lili { @include test6; }</span>
The content compiled into test.css is: (no variables)
<span style="color: #000000;">.lili { height: 5px; left: 20px; top: 10px; }</span>
What’s very useful about this method is that you can set variables, as follows:
The content of test.scss is: (with variables)
<span style="color: #000000;">@mixin test62($height) { height: $height; left: 20px; top: 10px; } .lili2 { @include test62(100px); }</span>
The content compiled into test.css is: (with variables)
<span style="color: #000000;">.lili2 { height: 100px; left: 20px; top: 10px; }</span>
7 functions
test.scss content is:
<span style="color: #000000;">@function aa($color) { @return $color; } .test7 { color: aa(pink); }</span>
The content compiled into test.css is:
<span style="color: #000000;">/*example 07*/ .test7 { color: pink; }</span>
8 Import external scss or css files
test.scss content is:
@import 'more.scss'
more.scss content is:
<span style="color: #000000;">$width: 30px; .test8 { width: $width; }</span>
The content compiled into test.css is:
<span style="color: #000000;">.test8 { width: 30px; }</span>

The article discusses the roles of <head> and <body> tags in HTML, their impact on user experience, and SEO implications. Proper structuring enhances website functionality and search engine optimization.

Article discusses specifying character encoding in HTML, focusing on UTF-8. Main issue: ensuring correct display of text, preventing garbled characters, and enhancing SEO and accessibility.

The article discusses various HTML formatting tags used for structuring and styling web content, emphasizing their effects on text appearance and the importance of semantic tags for accessibility and SEO.

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for

The article explains the HTML 'class' attribute's role in grouping elements for styling and JavaScript manipulation, contrasting it with the unique 'id' attribute.

Article discusses HTML list types: ordered (<ol>), unordered (<ul>), and description (<dl>). Focuses on creating and styling lists to enhance website design.

HTML entities are codes used in HTML to display special characters correctly, ensuring proper rendering across browsers and devices.

Collapsing white space optimizes content by reducing file size, enhancing readability, and ensuring consistent formatting across platforms in web and document processing.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
