Variables, Mixins, and Extending Selectors Flashcards

1
Q

@extend directive

A

@extend allows you to extend the attributes from one class or id onto another selector

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

When to use mixins vs. extends

A

mixins = arguments and advanced logic

extends = simple atributes

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

Assign your own variable called “lime” and give it a value of #090.

Use the “lime” variable to set the color of every link/anchor tag on the site.

Set another variable called sidebar_width - its value should be 100px.

Set the width of the class .inner_sidebar to be half that of the sidebar_width variable.

A

$lime: #090;
$sidebar_width: 100px;

a {
color: $lime;
}

.inner_sidebar {
width: $sidebar_width / 2;
}

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

Define a mixin called “button” that sets the background to be #369 and the color to be white.

Underneath your mixin definition, specify that all (a) tags should include the mixin.

A

@mixin button {
background: #369;
color: white;
}

a {
@include button;
}

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

Write a new definition for the “button” mixin, which takes two arguments: $color and $size. The background should be set using the value in the $color variable, and the width should be set using the $size variable. The height should be half of the value in the $size variable.

Use the mixin on a class called .menu_button. Set the background color to be #369 and the size to be 50px.

A

@mixin button($color, $size) {
background: $color;
width: $size;
height: $size / 2;
}

.menu_button {
@include button(#369, 50px)
}

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

Style the class .animals to have a background of #369. Use “extend” to apply those styles to a new class, .dogs.

Style a placeholder called “super_link”. Make the font-weight bold and the color red.

Now style a new class, .message_box. Nested inside, make sure all (a) tags within this class extend the “super_link” placeholder.

A

%super_link {
font-weight: bold;
color: red;
}

.animals {
background: #369;
}

.dogs {
@extend .animals;
}

.message_box {
a {
@extend %super_link;
}
}

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