scss variable code example

Example 1: SCSS variables

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}

Example 2: css variable

:root {
  --main-bg-color: pink;
}
body {
  background-color: var(--main-bg-color);
}

Example 3: scss variables

$base-color: #c6538c;

Example 4: scss variables

$base-color: #c6538c;
$border-dark: rgba($base-color, 0.88);

.alert {
  border: 1px solid $border-dark;
}

Example 5: variables scss

// SCSS variables

$darkcolor: #605C4D;
$large: 350px;

section{
	background-color: $darkcolor;
  	height: $large;
}

Example 6: Sass Variables

$myFont: Helvetica, sans-serif;
$myColor: red;
$myFontSize: 18px;
$myWidth: 680px;

body {
  font-family: $myFont;
  font-size: $myFontSize;
  color: $myColor;
}

#container {
  width: $myWidth;
}

Tags:

Css Example