Sass Flashcards

1
Q

Sass stands for…

A

Syntactically Awesome StyleSheets

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

Sass to CSS is

A

a language extension

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

what Sass does in a nutshell

A

adds features that aren’t available using basic CSS syntax

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

Sass makes it easier for…

A

developers to simplify and maintain the style sheets for projects

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

Sass is a…

A

preprocessor, it takes code written in Sass syntax and converts to basic CSS

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

With Sass you can…

A

create variables, nest CSS rules into others, import other Sass files

creates more compact, easier to read code

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

how many syntaxes available for Sass?

A

2:

  • SCSS (sassy CSS)
  • indented syntax or just Sass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SCSS

A

extension of CSS synatx. every valid CSS stylesheet is a valid SCSS file with the same meaning.

have .scss extension

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

Indented Sass

A

older syntax, uses indentation rather than brackets to indicate nesting of selectors,
newlines rather than semicolons to separate properties

have .sass extension

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

in Sass, variables start with

A

$ followed by the variable name

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

set style tag to use sass

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

nesting in Sass

A

parent {

child {};
}

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

a mixin in Sass is

A

a group of CSS declarations that can be reused throughout the stylesheet

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

use case for mixin

A

the treatment of box-shadow by different browsers has to be handled by prefixes like -webkit or -moz

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

implement mixin (box shadow example)

A

starts with @mixin then name (parameters optional)
{all the basic CSS code that you would have used}

@mixin box-shadow($x, $y, $blur, $c){ 
  -webkit-box-shadow: $x $y $blur $c;
  -moz-box-shadow: $x $y $blur $c;
  -ms-box-shadow: $x $y $blur $c;
  box-shadow: $x $y $blur $c;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

a mixin is called with

A

@include directive

div {
@include box-shadow(0px, 0px, 4px, #fff);
}

17
Q

add logic to style

A

@if, @else if, @else

@mixin text-effect($val) {
  @if $val == danger {
    color: red;
  }
  @else if $val == alert {
    color: yellow;
  }
  @else if $val == success {
    color: green;
  }
  @else {
    color: black;
  }
}
18
Q

create a Sass loop

A

@for

19
Q

@for is used 2 ways

A

start through end

start to end

20
Q

the main difference between start to end and start through end in @for loop is

A

start to end excludes the end number

start through end includes the end number

21
Q

syntax for @for loop (start through end)

A

@for $i from 1 through 12 {
.col-#{$i} { width: 100%/12 * $i; }
}

this is a powerful way to create a grid layout

22
Q

@each

A

loops over each item in a list or map.

On each iteration, the variable gets assigned to the current value from the list or map.

23
Q

@each example (assign color to blue, red, green) – using list

A

@each $color in blue, red, green {
.#{$color}-text {color: $color;}
}

24
Q

@each example (assign color to blue, red, green) – using map

A

$colors: (color1: blue, color2: red, color3: green);

@each $key, $color in $colors {
.#{$color}-text {color: $color;}
}

25
Q

@while example to create a grid of 12 columns

A

$x: 1; //seed the x variable
@while $x < 13 { // while x is less than 13
.col-#{$x} { width: 100%/12 * $x;} //same code as in @for
$x: $x + 1; // increment x
}

26
Q

Partials in Sass are

A

separate files that hold segments of CSS code. This is a great way to group similar code into a module to keep it organized.

27
Q

Names for partials start with

A

the underscore (_) character, which tells Sass it is a small segment of CSS and not to convert it into a CSS file.

28
Q

To bring the code in the partial into another Sass file,

A

use the @import directive.

if all your mixins are saved in a partial named “_mixins.scss”, and they are needed in the “main.scss” file, this is how to use them in the main file:

// In the main.scss file

@import ‘mixins’

29
Q

borrow the CSS rules from one element and build upon them in another with …

A

extend feature

30
Q

how to use extend

A
.new-class {
@extend .class; // note! no colon
// new rules
}