SCSS Flashcards

1
Q

What is sass/scss?

A

Syntactically Awesome Style Sheets - a superset of CSS

Sass code is transpiled to regular css

install sass package, can now do transpilation. Write sass code in .scss file, to transpile to .css file

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

Variables example

A

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

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

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

Nesting example

A

`
body{
background:green;

.container{
 border:1px solid red;
} } `
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are mixins used for?

A

Basically like functions that generate a list of rules to apply wherever the mixin is used.

`
// defaults to DarkGray

@mixin theme($theme: DarkGray) {
background: $theme;
box-shadow: 0 0 1px rgba($theme, .25);
color: #fff;
}

.info {
@include theme;
}
.alert {
@include theme($theme: DarkRed);
}
.success {
@include theme($theme: DarkGreen);
}

`

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

What are partials?

A

Create files that contain some SCSS code and import and apply it wherever it’s included.

Naming convention _something.scss

Any CSS code will be inserted where @import is used, and mixins/variables will become available for use.

`
// _base.scss
$font-stack: Helvetica, sans-serif;
$primary-color: #333;

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

// styles.scss
@import ‘base’;

.inverse {
background-color: base.$primary-color;
color: white;
}

becomes

body {
font: 100% Helvetica, sans-serif;
color: #333;
}

.inverse {
background-color: #333;
color: white;
}

`

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