0
0
SASSmarkup~20 mins

Vendor prefix mixin patterns in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Vendor Prefix Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the output CSS of this Sass mixin usage?
Given the following Sass mixin and usage, what CSS will be generated?
@mixin transform($value) {
  -webkit-transform: $value;
  -moz-transform: $value;
  transform: $value;
}

.box {
  @include transform(rotate(45deg));
}
SASS
@mixin transform($value) {
  -webkit-transform: $value;
  -moz-transform: $value;
  transform: $value;
}

.box {
  @include transform(rotate(45deg));
}
A
.box {
  -moz-transform: rotate(45deg);
  transform: rotate(45deg);
}
B
.box {
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
}
C
.box {
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}
D
.box {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  transform: rotate(45deg);
}
Attempts:
2 left
💡 Hint
Remember the order of properties in the mixin matches the output order.
🧠 Conceptual
intermediate
1:30remaining
Why use vendor prefix mixins in Sass?
Which of the following best explains why developers use vendor prefix mixins in Sass?
ATo write CSS properties once and automatically add all needed vendor prefixes for browser support.
BTo avoid writing any CSS properties and rely on browsers to add prefixes automatically.
CTo make CSS files larger by repeating properties with prefixes manually.
DTo prevent browsers from applying any vendor-specific styles.
Attempts:
2 left
💡 Hint
Think about how mixins help with repetitive code.
selector
advanced
1:30remaining
Which selector is targeted by this Sass mixin usage?
Given this Sass code, which CSS selector will the styles apply to?
@mixin user-select($value) {
  -webkit-user-select: $value;
  -moz-user-select: $value;
  -ms-user-select: $value;
  user-select: $value;
}

button {
  @include user-select(none);
}
SASS
@mixin user-select($value) {
  -webkit-user-select: $value;
  -moz-user-select: $value;
  -ms-user-select: $value;
  user-select: $value;
}

button {
  @include user-select(none);
}
AOnly <button> elements with class 'user-select'
BOnly <button> elements inside a container with class 'user-select'
CAll <button> elements on the page
DAll elements with attribute user-select='none'
Attempts:
2 left
💡 Hint
Look at the selector before the mixin usage.
layout
advanced
2:00remaining
How does this vendor prefix mixin affect layout rendering?
Consider this Sass mixin and usage:
@mixin flex-center {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  @include flex-center;
  height: 200px;
}

What visual effect will the container have?
SASS
@mixin flex-center {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  @include flex-center;
  height: 200px;
}
AThe container will center its child elements horizontally and vertically within 200px height.
BThe container will stack child elements vertically without centering.
CThe container will hide child elements due to conflicting display properties.
DThe container will scroll child elements horizontally.
Attempts:
2 left
💡 Hint
Think about what flexbox centering does.
accessibility
expert
2:30remaining
Which vendor prefix mixin usage best supports accessibility for focus outlines?
Which Sass mixin usage ensures consistent focus outlines across browsers for accessibility?
@mixin focus-outline($color) {
  outline: 2px solid $color;
  outline-offset: 2px;
  -webkit-outline-offset: 2px;
}

Choose the correct usage:
SASS
@mixin focus-outline($color) {
  outline: 2px solid $color;
  outline-offset: 2px;
  -webkit-outline-offset: 2px;
}

input:focus {
  @include focus-outline(blue);
}
Ainput:focus { @include focus-outline(blue); }
Binput:focus-visible { @include focus-outline(blue); }
Cinput { @include focus-outline(blue); }
Dinput:hover { @include focus-outline(blue); }
Attempts:
2 left
💡 Hint
Focus outlines should appear only when keyboard focusing, not on hover.