SASS Flashcards

1
Q

Create a loop where variable i goes from 1 to 10.

A

@for $i from 1 through 10 {

.box-#{$i} { // some styles }

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

Interpolate the variable $i so you can make classes called .box-1, .box-2, etc, based on a loop.

A

.box-#{$i} { // some styles }

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

Assuming you have variable $i = 1, calculate percentage of 1/12 in order to say width: 8.33333%;

A

width: percentage($i / 12); // no need for % sign

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

What’s a sass map?

A

A set of key/value pairs, like a js object. Syntax is:
$sizes: ( small: 10%, medium: 25%, large: 100% )
// use parens and commas.

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

Loop over a sass map

A

@each $key, $value in $map { … }

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

Create a reusable media query mixin

A

@mixin smallScreen ($w: 800px) {
@media screen and (max-width: $w) {
@content
}

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

Instead of writing @media for a media query, use a mixin called ‘smallScreen’ to style an h1 element.

A

@include smallScreen {

h1 { // styles

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

Create a function taking a number and returning it as an em.

A

@function toEm($num) {

@return #{$num}em; // or $num * 1em;

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

Use a sass function called getWidth() in a style value for width.

A

width: getWidth(n);

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