-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCSS
92 lines (66 loc) · 2.34 KB
/
SCSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
SASS- CSS
SCSS- CSS 3
SCSS - CSS PREPROCESSORS
.scss file in converted to .css property by "LIVE SASS COMPILER EXTENSION"
Sass has features that don't exist in CSS yet like nesting, mixins, inheritance, and other nifty goodies that help you write robust, maintainable CSS.
Once you start tinkering with Sass, it will take your preprocessed Sass file and save it as a normal CSS file that you can use in your website.
=========================
VARIABLES:
=========================
NESTING:
=========================
PARTIALS:
_partial.scss file for use of partial scss and that should not be generate into a .css file. SASS parials are used using @use rule.
==========================
MODULE:
SASS don't have to be writte in same file, so they are split in different PARTIAL SCSS file, where we can refer to them using @use rule.
SASS file as a module, i.e WE CAN REFER to its variables, mixins, & functions in your SASS file with a namespace based on the filename.
example:
_base.scss
$font-stack: TIMES NEW ROMAN;
$primary-color: #333;
body{
font: 100% $font-stack;
color: $primary-color;
}
//styles.scss
@use 'base';
.inverse{
background-color: base.$primary-color;
color: white;
}
===========================
MIXINS: Some thing in CSS are tedious to write. A MIXIN lets to make a GROUP OF CSS DECLARATIONS THAT YOU WANT TO REUSE THROUGHTOUT YOUR SITE.
@mixin theme($theme: DarkGrey) {
background: $theme;
box-shadow: 0 0 1px rgba($theme, .25);
color: #fff;
}
//other things will remain same for .alert from @mixin theme, just theme: is changed from default to DarkRed;
.info{
@include theme;
}
.alert{
@include theme($theme: DarkRed);
}
============================
EXTENDED INHERITANCE:
Using @extend lets you share a set of CSS properties from ONE SELECTOR TO ANOTHER.
A placeholder class is a special type of class that only prints when it is extended, and can help keep your compiled CSS neat and clean.
//placeholder class
%message-shared{
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.message{
//class needs to be extended to use the properties of PLACEHOLDER CLASS
@extend %message-shared
}
=======================
OPERATOR:
@use "saas:math";
article[role="main"]{
width: math.div(600px, 960px) * 100%;
}
======================