SCSS Introduction

Hey Guys, I realized I've been using SCSS in most of my Codepens. But we never really touched based on this topic.

So let's dive into introducing SCSS to you all.

BTW: I have a free Giveaway on Twitter! 🚨 Free Giveaway

What Does SCSS Mean?

It stands for sassy css and is basically the follow up for SASS stylesheets. You will find many people calling it SASS or SCSS, but either way, they are very similar and used for modular CSS setup.

In general, some common use cases are:

We won't be going through all these topics today, but I will touch base on them during the next couple of days.

How Does SCSS Work

A major thing to keep in mind is that a browser won't understand SCSS or SASS code. We need to process it and turn it into regular CSS files.

There are several ways to do this; the simplest is using a pre-processing plugin, for instance for Visual Studio:

Download Sass Compiler

This will run in Visual Studio and compile your SCSS files into one CSS file.

There are also specific SASS compilers see the website for more information:

SASS Compilers

Our First SCSS Example

Let's get right in there with a very basic example:

<div class="container">
  <div class="box">
    🤩 SCSS 🤩
  </div>
</div>
$primary: #ffd670;
$secondary: #ff9770;

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: $primary;
}

.box {
  background: $secondary;
  padding: 50px;
  border-radius: 20px;
  color: $primary;
  font-size: 2rem;
  font-weight: bold;
}

As you can see, we can now quickly change our colors, instead of having them repeating in every element styling.

This will result in the following Codepen.

Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

No Comments Yet