SCSS Flashcards

1
Q

CSS with superpowers

A

Officially described as “CSS with superpowers,” SCSS (or Sass) offers a way to write styles for websites with more enhanced CSS syntax. In general, browsers do not know how to process SCSS features, such as functions, mixins, and nesting. We’ll need to convert them to regular CSS files to run them in the browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What’s the difference between SCSS and Sass?

A

This is where most beginners get confused. SCSS and Sass are two syntax flavors for the same concept. The difference between them is UI.

SCSS
Stands for Sassy CSS
Similar to CSS (uses curly braces and semicolons)
Any valid CSS is valid SCSS
.scss extension
Sass
Stands for Syntactically Awesome Style Sheets
Uses strict indentation (like Python)
CSS code cannot be used as SASS
.sass extension

Here’s an example of SCSS:

body {
  background-color:#000;
  color:#fff;
}
Below is an example of Sass.

body
background-color:#000;
color:#fff;
It’s up to you to choose one. Don’t stress on the decision — you can easily convert SCSS to Sass and vice versa with the sass-convert tool.

In this article, I’ll focus on SCSS mainly for two reasons.

SCSS syntax is similar to CSS, so it’s easy to explain the advancements for someone who already knows CSS
Once you know SCSS, it takes only a few minutes to learn Sass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Any valid CSS is valid SCSS

A

Any valid CSS is valid SCSS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Sass - old one and SCSS - new one both are from SASS

Sass was the original version of this new language; SCSS is an improved version they created later.

A

Sass is a CSS pre-processor with syntax advancements. Style sheets in the advanced syntax are processed by the program, and turned into regular CSS style sheets. However, they do not extend the CSS standard itself.

CSS variables are supported and can be utilized but not as well as pre-processor variables.

For the difference between SCSS and Sass, this text on the Sass documentation page should answer the question:

There are two syntaxes available for Sass. The first, known as SCSS (Sassy CSS) and used throughout this reference, is an extension of the syntax of CSS. This means that every valid CSS stylesheet is a valid SCSS file with the same meaning. This syntax is enhanced with the Sass features described below. Files using this syntax have the .scss extension.

The second and older syntax, known as the indented syntax (or sometimes just “Sass”), provides a more concise way of writing CSS. It uses indentation rather than brackets to indicate nesting of selectors, and newlines rather than semicolons to separate properties. Files using this syntax have the .sass extension.

However, all this works only with the Sass pre-compiler which in the end creates CSS. It is not an extension to the CSS standard itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To run SCSS code in a web browser, you must first convert it to CSS. We’ll discuss tools you can use for this and how to automate the process later.

A

Unfortunately, the features of SCSS have yet to be introduced in the CSS specs and, therefore, are not supported by browsers. To run SCSS code in a web browser, you must first convert it to CSS. We’ll discuss tools you can use for this and how to automate the process later.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The structure of SCSS rules

A

The structure of SCSS follows that of CSS. First, choose one or more elements using IDs, classes, or other CSS selectors. Then, add styles.

In this example, we select the elements with button class and add some properties. This is valid as CSS code as well as SCSS code. It’s important to note that SCSS supports all CSS properties.

.button {
  display:inline-block;
  font-size:14px;
  padding:4px 10px;
}
Comments in SCSS
Both // (single-line) and /* */ (multi-line) comments are allowed in SCSS.

// this is a single-line comment

/* this is a multi-line comment */
Now let’s go over the basic enhancements of SCSS. We’ll discuss how to compile SCSS to CSS in the final section. For now, you can use CodePen to write and test your code. Make sure you select SCSS as the preprocessor in CSS settings.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ou can use CodePen to write and test your code. Make sure you select SCSS as the preprocessor in CSS settings.

A

https: //codepen.io/
http: //beautifytools.com/scss-compiler.php

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Nesting

Here’s the bottom line: nesting makes code more clear, organized, and concise, but be careful not to overuse it.

if possible keep it little flat as it might save some memory

A

https://blog.logrocket.com/the-definitive-guide-to-scss/

Your grandpa styled his navbar like this with CSS:

nav {
  background-color:#333;
  padding:1em;
}
nav ul {
  margin:0;
  padding:0;
  list-style:none;
}
nav ul li {
  display:inline-block;
}
But you can do so with SCSS, like this:
nav {
  background-color:#333;
  padding:1em;
  ul {
    margin:0;
    padding:0;
    list-style:none;
    li {
      display:inline-block;
    }
  }
}
Much more organized and concise, right? You have two major advantages over your grandpa:

You know that all the styles of nav and its children are between curly braces, so you don’t need to find them in the file or in multiple files
You simply write less code, so there is no repetition
Keep in mind, however, that when you go much deeper with nesting, the CSS file can become much larger and browsers will need to do more work to style the elements. Try to keep the selectors shallow. For example, we can save several bytes by taking the styles of li to the outer scope.

nav {
  background-color:#333;
  padding:1em;
  ul {
    margin:0;
    padding:0;
    list-style:none;
  }
  li {
    display:inline-block;
  }
}
For larger projects, this can save a huge amount of bandwidth.

It’s important to make sure this process doesn’t create any conflicts. For example:

content {
  ul {
    li {
      font-style:italic;
    }
  }
  ol {
    li {
      font-decoration:underline;
    }
  }
}
In this case, we cannot bring the styles of li elements to the outer scope because they have different rules.

Here’s the bottom line: nesting makes code more clear, organized, and concise, but be careful not to overuse it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Using & in nesting

& always refers to the upper selection. Below are some use cases. like the parent element

A

Your grandpa shows off his magical button that changes color when you hover over it. His CSS code looks like this:

button {
  background-color: #535353;
  color: #000;
}
button:hover {
  background-color: #000;
  color: #fff;
}
You can achieve the same effect much more easily with SCSS by using the & character in nesting.
button {
  background-color: #535353;
  color: #000;
  &:hover {
    background-color: #000;
    color: #fff;
  }
}
& always refers to the upper selection. Below are some use cases.
.some-class {
  &:hover {
    /* when hovered */
  }
  &:focus {
    /* when focused */
  }
  & > button {
    /* selector equls to .some-class > button */
  }
  &-cool {
    /*** Notice this! ****/
    // selects .some-class-cool elements
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Variables

A

Variables store data. In SCSS, you can save any CSS value (even with units) in variables. Variables are defined using the $ symbol.

Variable declaration:

$my-font: Nunito, sans-serif;
$my-font-color: #ffd969;
$content-width: 660px;
Variable usage:

body {
  font-family: $my-font;
  color: $my-font-color;
  content {
    width: $content-width;
  }
} 
When Sass is converted to CSS, all the variables are replaced with their original values. SCSS variables are useful to keep fonts, colors, and other values consistent thought a website or web app.
css generated:
body {
	font-family: Nunito, sans-serif;
	color: #ffd969;
}

body content {
width: 660px;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The difference between SCSS and CSS variables

CSS variables are more powerful

A

SCSS variables are replaced with values when converted into CSS variables. These conversions take place before they are served to the browser, so browsers don’t even know there were variables in the first place, they just see the values. On the other hand, CSS variables are much more powerful.

CSS-Tricks outlined several advantages of CSS variables:

They cascade; you can set a variable inside any selector to set or override its current value
When a variable’s value changes (e.g., media query or another state), the browser repaints as needed
You can access and manipulate variables in JavaScript
Does that mean Grandpa wins? Not exactly: you can use CSS variables in SCSS stylesheets, since any valid CSS is also valid SCSS. If you’re curious about CSS variables, you can learn more here.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Using CSS custom properties (variables)

this could be used in scss as well

A

https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

Custom properties (sometimes referred to as CSS variables or cascading variables) are entities defined by CSS authors that contain specific values to be reused throughout a document. They are set using custom property notation (e.g., –main-color: black;) and are accessed using the var() function (e.g., color: var(–main-color);).

Complex websites have very large amounts of CSS, often with a lot of repeated values. For example, the same color might be used in hundreds of different places, requiring global search and replace if that color needs to change. Custom properties allow a value to be stored in one place, then referenced in multiple other places. An additional benefit is semantic identifiers. For example, –main-text-color is easier to understand than #00ff00, especially if this same color is also used in other contexts.

Custom properties are subject to the cascade and inherit their value from their parent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Basic usage of CSS variables

usually they are declare with :root pseudo class, so that it could be used across

A

Declaring a custom property is done using a custom property name that begins with a double hyphen (–), and a property value that can be any valid CSS value. Like any other property, this is written inside a ruleset, like so:

element {
–main-bg-color: brown;
}
Note that the selector given to the ruleset defines the scope that the custom property can be used in. A common best practice is to define custom properties on the :root pseudo-class, so that it can be applied globally across your HTML document:

:root {
–main-bg-color: brown;
}
However, this doesn’t always have to be the case: you maybe have a good reason for limiting the scope of your custom properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

accessing CSS custom property names/variables

A

Note: Custom property names are case sensitive — –my-color will be treated as a separate custom property to –My-color.

As mentioned earlier, you use the custom property value by specifying your custom property name inside the var() function, in place of a regular property value:

element {
background-color: var(–main-bg-color);
}

This leads to the same result as the previous example, yet allows for one canonical declaration of the desired property value; very useful if you want to change the value across the entire page later.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Inheritance of custom properties CSS

A

Custom properties do inherit. This means that if no value is set for a custom property on a given element, the value of its parent is used. Take this HTML:

<div class="one">
  <div class="two">
    <div class="three"></div>
    <div class="four"></div>
  </div>
</div>
... with the following CSS:

.two {
–test: 10px;
}

.three {
–test: 2em;
}
In this case, the results of var(–test) are:

For the class=”two” element: 10px
For the class=”three” element: 2em
For the class=”four” element: 10px (inherited from its parent)
For the class=”one” element: invalid value, which is the default value of any custom property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Keep in mind that these are custom properties, not actual variables like you might find in other programming languages. The value is computed where it is needed, not stored for use in other rules. For instance, you cannot set a property for an element and expect to retrieve it in a sibling’s descendant’s rule. The property is only set for the matching selector and its descendants, like any normal CSS.

A

Keep in mind that these are custom properties, not actual variables like you might find in other programming languages. The value is computed where it is needed, not stored for use in other rules. For instance, you cannot set a property for an element and expect to retrieve it in a sibling’s descendant’s rule. The property is only set for the matching selector and its descendants, like any normal CSS.

these are more like setting margin, which follow inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

CSS Custom property fallback values

A

Using the var() function, you can define multiple fallback values when the given variable is not yet defined; this can be useful when working with Custom Elements and Shadow DOM.

Fallback values aren’t used to fix the browser compatibility. If the browser doesn’t support CSS custom Properties, the fallback value won’t help. It’s just a backup for the browser which supports CSS Custom Properties to choose a different value if the given variable isn’t defined or has an invalid value.

The first argument to the function is the name of the custom property to be substituted. The second argument to the function, if provided, is a fallback value, which is used as the substitution value when the referenced custom property is invalid. The function only accepts two parameters, assigning everything following the first comma as the second parameter. If that second parameter is invalid, such as if a comma-separated list is provided, the fallback will fail. For example:

.two {
color: var(–my-var, red); /* Red if –my-var is not defined */
}

.three {
background-color: var(–my-var, var(–my-background, pink)); /* pink if –my-var and –my-background are not defined */
}

.three {
background-color: var(–my-var, –my-background, pink); /* Invalid: “–my-background, pink” */
}

Including a custom property as a fallback, as seen in the second example above, is the correct way to provide more than one fallback. The technique has been seen to cause performance issues as it takes more time to parse through the variables.

Note: The syntax of the fallback, like that of custom properties, allows commas. For example, var(–foo, red, blue) defines a fallback of red, blue — anything between the first comma and the end of the function is considered a fallback value.

18
Q

Custom property -Validity and values

A

The classical CSS concept of validity, tied to each property, is not very useful in regard to custom properties. When the values of the custom properties are parsed, the browser doesn’t know where they will be used, so must, therefore, consider nearly all values as valid.

Unfortunately, these valid values can be used, via the var() functional notation, in a context where they might not make sense. Properties and custom variables can lead to invalid CSS statements, leading to the new concept of valid at computed time.

19
Q

What happens with invalid CSS variables?

A

When the browser encounters an invalid var() substitution, the initial or inherited value of the property is used.

Consider the code snippet below.

HTML
<p>This paragraph is initial black.</p> 
CSS
\:root { --text-color: 16px; } 
p { color: blue; } 
p { color: var(--text-color); }
As expected, the browser substitutes the value of --text-color in place of var(--text-color), but 16px is not a valid property value for color. After substitution, the property doesn’t make any sense. The browser handles this situation in two steps:

Check if the property color is inheritable. Yes, but <p> doesn’t have any parent with color property. So move on to the next step.
Set the value to its default initial value, i.e., black.

The paragraph color will not be blue because invalid substitution is replaced by the initial value, not by the fallback. If you had written color: 16px without any variable substitutes, then it was a syntax error. The previous declaration will then be used.

Note: While a syntax error in a CSS property / value pair will lead to the line being ignored, using a cascaded value, invalid substitution – using a custom property value that is invalid – is not ignored, leading to the value to be inherited.</p>

20
Q

CSS Property Values in JavaScript

A

https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

To use the values of custom properties in JavaScript, it is just like standard properties.

// get variable from inline style
element.style.getPropertyValue("--my-var");
// get variable from wherever
getComputedStyle(element).getPropertyValue("--my-var");
// set variable on inline style
element.style.setProperty("--my-var", jsVar + 4);
21
Q

SCSS variable scope

A

Some things to keep in mind:

All variables defined in the top level are global
All variables defined in blocks (i.e., inside curly braces) are local
Blocks can access both local and global variables
$my-global-variable: “I’m global”;
div {
$my-local-variables: “I’m local”;
}

22
Q

Changing the values of SCSS variables

A

Changing values is done in the same way as declaring. When you change a variable, subsequent uses will have the new value while the previous uses remain unchanged.

$color: #fefefe;
.content {
background-color: $color;
}

$color: #939393;
.footer {
  background-color: $color;
}
Here, .content will have the background color #fefefe while .footer will have #939393. Global variables won’t change unless we add the !global modifier.
$color: #111;
.content {
  $color: #222; // this is a new local variable
  background-color: $color; # 222
}
.footer {
  $color: #333 !global; // changes the global variable  
}
23
Q

Mixins

A

Let’s outdo your grandfather’s CSS again, this time with mixins.

A mixin is a group of CSS declarations that can be reused. The syntax is similar to functions in JavaScript. Instead of the function keyword, use the @mixin directive. You can have arguments too. Calling the mixin is done via the @include statement.

Here’s how to use mixins to position elements to absolute center:

@mixin absolute-center() {
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
}
.element-1 {
  @include absolute-center();
}
.element-2 {
  @include absolute-center();
  color:blue;
}
First, we defined the absolute-center mixin. Then, we used it in multiple blocks.
24
Q

Mixins with arguments

A

Below is an example of how to use arguments in mixins.

@mixin square($size) {
  width:$size;
  height:$size;
}
div {
  @include square(60px);
  background-color:#000;
}
25
Q

Mixins with optional arguments

A

Optional arguments can be defined in the same way we declared SCSS variables.

@mixin square($size: 40px) {
  width:$size;
  height:$size;
}
div {
  @include square();
  background-color:#000;
}
26
Q

Mixins with content blocks

A

Instead of arguments, we can send CSS rules to the mixins. Those rules can be used in the mixin using @content.

@mixin hover-not-disabled {
  &amp;:not([disabled]):hover {
    @content;
  }
}
.button {
  border: 1px solid black;
  @include hover-not-disabled {
    border-color: blue;
  }
}
This approach allows us to reduce the repetition of the &amp;:not([disabled]):hover part.
--
Generated CSS
.button {
	border: 1px solid black;
}

.button:not([disabled]):hover {
border-color: blue;
}

27
Q

Importing SCSS (@import and @use)

A

Chunking code is an important practice when creating larger apps. Your grandpa can do this by creating multiple CSS files and adding them all to the HTML document.

Grandpa’s process is tedious. It requires the browser to make many HTTP requests, which may slow down his website.

SCSS is much better because it enables you to combine chunked files before sending the code to the browser. That way, you only need to link only one CSS file (which is usually named something.bundle.css).

@import
The examples below demonstrate how to chunk files and import them into one parent file using @import.

normalize.scss:

body {
  padding:0;
  margin:0;
}
body, html {
  width:100%;
  min-height:100%;
}
styles.scss:

@import ‘normalize’;

content {
  max-width:660px;
  // and more styles
}
Assuming that both normalize.scss and styles.scss are in the same folder, we can import one to another, as shown above.

When using @import, all the variables, mixins, etc. become globally accessible, which is a problem when you have complex file structures and use libraries. For this reason, using @importis now officially discouraged.

The solution is @use.

28
Q

Arithmetic operators

A

You can do some math in SCSS without Grandpa’s CSS calc() function. You can use +,-,/,*,%, direct values, and variables for calculations.

$content-width: 600px;
content {
  width:$content-width;
}
.inner-content {
  width: $content-width - 60px; // substraction
}
.outer-content {
  width: $content-width + 60px; // addition
}

Generated CSS:
content {
width: 600px;
}

.inner-content {
width: 540px;
}

.outer-content {
width: 660px;
}

29
Q

Flow control rules

A

There are four types of flow control rules: @if /@else, @each, @for, and @while

30
Q

@if and @else– are similar to if and else in JavaScript.

A
// ex: using in mixins
@mixin theme($is-dark: false) {
  @if $is-dark {
    // styles for dark
    color:black;
  }
  @else {
    // styles for light
    color:white;
  }
}
div
{
@include theme(true)    ;
}

====css
div {
color: black;
}

31
Q

@each is similar to for of in JavaScript.

A

Note: The #{$size} notation is used to make dynamic property names and selectors using variables. This is called interpolation.

// creating automated 
$sizes: 40px, 50px, 80px,100px;
@each $size in $sizes {
  .icon-#{$size} {
    font-size: $size;
    height: $size;
    width: $size;
  }
}
---
Generated CSS
.icon-40px {
	font-size: 40px;
	height: 40px;
	width: 40px;
}
.icon-50px {
	font-size: 50px;
	height: 50px;
	width: 50px;
}
.icon-80px {
	font-size: 80px;
	height: 80px;
	width: 80px;
}
.icon-100px {
	font-size: 100px;
	height: 100px;
	width: 100px;
}
32
Q

assigning multiple values to SCSS variable

A

$sizes: 40px, 50px, 80px 100px;

33
Q

@for is similar to for loops in JavaScript.

A
@for $i from 1 through 4 {
  .bubble-#{$i} {
    transition-delay: .3 * $i;
  }
}

–css
.bubble-1 {
transition-delay: 0.3;
}

.bubble-2 {
transition-delay: 0.6;
}

.bubble-3 {
transition-delay: 0.9;
}

.bubble-4 {
transition-delay: 1.2;
}

34
Q

@while (not often used) is similar to while loops in JavaScript.

A

@while (not often used) is similar to while loops in JavaScript.

35
Q

compile Sass into CSS.

A

Before we get started, we have to install the sass command line, which is the easiest tool to preprocess CSS. If you’re using npm, use the following code.

npm i -g sass
Check the installation guide for some additional ways to install the sass command line.

With the sass command line, you can parse both .scss and .sass files into .css. It automatically detects SCSS and Sass files by extension and uses the correct parser.

sass source.scss destination.css

36
Q

Designing a simple blog page with SCSS

A

To demonstrate the sass command line and to review the concepts outlined above, let’s design a simple blog with one component: content (we’ll skip the header and footer to make it clearer).

First, create a folder on your local machine (I named it my-blog) and navigate there.

cd /path/to/my-blog
Then, create two more folders.

mkdir source build
We’ll place the .scss files in the source folder and preprocessed .css files in the build folder.

Next, create an index.html file in the root, open it in your favorite text editor, and add some HTML code.

        Blog content goes here

Now it’s time to create our new SCSS files. Our main file will be source/index.scss, and it will include other files.

To start writing SCSS, we’ll set up a watcher to compile source/index.scss into build/index.css in real time. Use the –watch option in the sass command line.

sass –watch source/index.scss build/index.css
Finally, create the chunked SCSS files.

// index.scss
@use 'normalize';

@use ‘Content’;
@use ‘Footer’;

body {
background-color:#fafafa;
font-family: Segoe UI, sans-serif;
}

// _normalize.scss
body, html {
    margin:0;
    padding:0;
}
* {
    box-sizing:border-box;
}
content {
    display:block;
}
// _colors.scss
$content-box: #fff;
$footer: #222;
$footer-font: #fff; 
To recognize them easily, I name components’ style files in the Content.scss format.
// Content.scss
@use 'colors' as colors;
body > content {
    padding:40px;
    margin:auto;
    width:660px;
    max-width:100%;
    &amp; > content {
        background-color: colors.$content-box;
        min-height:600px; // to look cool
        border-radius:20px;
        box-shadow:10px 10px 40px rgba(0,0,0,0.06);
        padding:40px;
    }
}
Now that we’ve created a basic blog page, let’s add some media queries.
37
Q

Adding Media Queries

A

Let’s say we need to remove the padding of the parent element in mobile devices (<600px). We can do that it in two ways.

The conventional CSS way is to add media queries globally.

@media screen and (max-width:600px) {
  body > content {
    padding:0;
  }
}
The SCSS way is to add media queries inside selectors.
body > content {
  @media screen and (max-width:600px) {
      padding:0;
  }
}
Both methods are valid; you can use whichever you prefer. Some developers save all media queries in a single file (e.g., Mobile.scss).
38
Q

SCSS with webpack or Gulp

A

While the sass command line is straightforward and easy to use, if you are using a bundler like webpack or Gulp, you can use plugins to parse SCSS to CSS on bundling. Check out the following guides for each bundler. One advantage of a bundler is that you can use it to parse, autoprefix, and minify at the same time.

39
Q

Built-In Modules

A

https://sass-lang.com/documentation/modules

Sass provides many built-in modules which contain useful functions (and the occasional mixin). These modules can be loaded with the @use rule like any user-defined stylesheet, and their functions can be called like any other module member. All built-in module URLs begin with sass: to indicate that they’re part of Sass itself.

⚠️ Heads up!
Before the Sass module system was introduced, all Sass functions were globally available at all times. Many functions still have global aliases (these are listed in their documentation). The Sass team discourages their use and will eventually deprecate them, but for now they remain available for compatibility with older Sass versions and with LibSass (which doesn’t support the module system yet).

A few functions are only available globally even in the new module system, either because they have special evaluation behavior (if()) or because they add extra behavior on top of built-in CSS functions (rgb() and hsl()). These will not be deprecated and can be used freely.

SCSSSassCSS
SCSS SYNTAX
@use “sass:color”;

.button {
  $primary-color: #6b717f;
  color: $primary-color;
  border: 1px solid color.scale($primary-color, $lightness: 20%);
}
CSS OUTPUT
.button {
  color: #6b717f;
  border: 1px solid #878d9a;
}

Sass provides the following built-in modules:

The sass:math module provides functions that operate on numbers.

The sass:string module makes it easy to combine, search, or split apart strings.

The sass:color module generates new colors based on existing ones, making it easy to build color themes.

The sass:list module lets you access and modify values in lists.

The sass:map module makes it possible to look up the value associated with a key in a map, and much more.

The sass:selector module provides access to Sass’s powerful selector engine.

The sass:meta module exposes the details of Sass’s inner workings.

40
Q

Global functions

A

Global Functions permalinkGlobal Functions
hsl($hue $saturation $lightness)
hsl($hue $saturation $lightness / $alpha)
hsl($hue, $saturation, $lightness, $alpha: 1)
hsla($hue $saturation $lightness)
hsla($hue $saturation $lightness / $alpha)
hsla($hue, $saturation, $lightness, $alpha: 1) //=> color
Compatibility (Level 4 Syntax):
Dart Sass
since 1.15.0
LibSass

Ruby Sass