Option A correctly uses Sass maps to group colors for each brand, allowing easy access like map-get($brandA-colors, primary). Option A defines separate variables but does not group them, making management harder. Options A and C use invalid syntax for Sass maps.
$brandA-colors: (primary: #ff0000, secondary: #00ff00);, which option correctly uses map-get to set the background color to the primary brand color?map-get is the map first, then the key.Option D correctly calls map-get with the map variable first and the key second. Options A, B, and D use incorrect syntax or invalid Sass map access methods.
$brandA-colors: (primary: #ff0000, secondary: #00ff00);
$brandB-colors: (primary: #0000ff, secondary: #ffff00);
@mixin brand-button($brand-colors) {
background-color: map-get($brand-colors, primary);
border: 2px solid map-get($brand-colors, secondary);
color: white;
}
.button-brandA {
@include brand-button($brandA-colors);
}
.button-brandB {
@include brand-button($brandB-colors);
}$brandA-colors: (primary: #ff0000, secondary: #00ff00); $brandB-colors: (primary: #0000ff, secondary: #ffff00); @mixin brand-button($brand-colors) { background-color: map-get($brand-colors, primary); border: 2px solid map-get($brand-colors, secondary); color: white; } .button-brandA { @include brand-button($brandA-colors); } .button-brandB { @include brand-button($brandB-colors); }
map-get accesses the primary and secondary colors for each brand.Option A shows the correct CSS output with the primary color as background and secondary color as border for each brand. Option A shows Sass code, not compiled CSS. Options C and D swap colors incorrectly.
.button class using nested selectors for two brands: .brandA and .brandB. Which option correctly nests the selectors to apply different background colors for each brand?Option C correctly nests .brandA and .brandB as modifiers of .button using &.brandA and &.brandB. Option C reverses the order, targeting elements inside .brandA which is different. Option C and D create separate selectors or nested classes incorrectly.
Option B uses Sass functions to calculate contrast ratios and conditionally set text colors, automating accessibility checks. Option B is manual and inefficient. Option B ignores contrast needs. Option B risks poor contrast on light backgrounds.