Bird
Raised Fist0
SASSmarkup~10 mins

Why SASS improves responsive workflows - Test Your Understanding

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a SASS variable for a breakpoint.

SASS
$breakpoint: [1];
Drag options to blanks, or click blank then click option'
A768px
Bmargin
Ccolor
Dfont-size
Attempts:
3 left
💡 Hint
Common Mistakes
Using property names instead of pixel values
Forgetting the unit 'px'
2fill in blank
medium

Complete the code to create a mixin for a media query using the breakpoint variable.

SASS
@mixin respond-to { @media (max-width: [1]) { @content; } }
Drag options to blanks, or click blank then click option'
A$breakpoint
B$color
C$margin
D$font-size
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated variables
Omitting the dollar sign
3fill in blank
hard

Fix the error in the code to apply styles inside the respond-to mixin.

SASS
.container { @include respond-to { width: [1]; } }
Drag options to blanks, or click blank then click option'
A100px
Bnone
Cauto
D100%
Attempts:
3 left
💡 Hint
Common Mistakes
Using fixed pixel widths that don't adapt
Using invalid CSS values
4fill in blank
hard

Fill both blanks to create a nested media query inside a class using the respond-to mixin.

SASS
.menu { display: flex; [1] respond-to { flex-direction: [2]; } }
Drag options to blanks, or click blank then click option'
A@include
Brow
Ccolumn
Dmargin
Attempts:
3 left
💡 Hint
Common Mistakes
Using property names instead of @include
Using 'row' which is default flex direction
5fill in blank
hard

Fill all three blanks to create a responsive card style with padding and font size inside a media query.

SASS
.card { padding: [1]; font-size: [2]; @include respond-to { padding: [3]; } }
Drag options to blanks, or click blank then click option'
A2rem
B1.5rem
C1rem
D3rem
Attempts:
3 left
💡 Hint
Common Mistakes
Using same padding for both places
Using inconsistent units

Practice

(1/5)
1. Why does using SASS make responsive design easier compared to plain CSS?
easy
A. Because SASS allows reuse of code with mixins and variables for screen sizes
B. Because SASS automatically creates media queries without any code
C. Because SASS replaces HTML for responsive layouts
D. Because SASS removes the need for CSS selectors

Solution

  1. Step 1: Understand SASS features for responsiveness

    SASS provides mixins and variables that let you write media queries once and reuse them easily.
  2. Step 2: Compare with plain CSS

    Plain CSS requires repeating media queries everywhere, making it slower and error-prone.
  3. Final Answer:

    Because SASS allows reuse of code with mixins and variables for screen sizes -> Option A
  4. Quick Check:

    Mixins and variables = easier responsive design [OK]
Hint: Remember: mixins save repeating media queries [OK]
Common Mistakes:
  • Thinking SASS auto-generates media queries
  • Confusing SASS with HTML features
  • Believing SASS removes CSS selectors
2. Which of the following is the correct SASS syntax to create a mixin for a media query targeting screens wider than 600px?
easy
A. mixin respond { media (min-width: 600px) { content } }
B. @media respond { min-width: 600px; } @content
C. @include respond { @media (min-width: 600px) { content } }
D. @mixin respond { @media (min-width: 600px) { @content; } }

Solution

  1. Step 1: Recall SASS mixin syntax

    A mixin is declared with @mixin name { ... } and uses @content to insert passed styles.
  2. Step 2: Check media query inside mixin

    The media query must be inside the mixin block, wrapping @content.
  3. Final Answer:

    @mixin respond { @media (min-width: 600px) { @content; } } -> Option D
  4. Quick Check:

    @mixin + @media + @content = correct mixin [OK]
Hint: Mixins start with @mixin and use @content inside [OK]
Common Mistakes:
  • Using @include instead of @mixin to declare
  • Placing media query outside mixin block
  • Missing @content inside mixin
3. Given this SASS code, what CSS will be generated?
$breakpoint: 768px;

@mixin respond {
  @media (min-width: #{$breakpoint}) {
    @content;
  }
}

.container {
  width: 100%;
  @include respond {
    width: 750px;
  }
}
medium
A. .container { width: 100%; width: 750px; } @media (min-width: 768px) { }
B. .container { width: 100%; } @media (min-width: 768px) { .container { width: 750px; } }
C. @media (min-width: 768px) { .container { width: 100%; width: 750px; } }
D. .container { width: 750px; } @media (min-width: 768px) { .container { width: 100%; } }

Solution

  1. Step 1: Understand variable interpolation

    The variable $breakpoint is 768px and is inserted into the media query with #{$breakpoint}.
  2. Step 2: Analyze mixin usage

    The mixin wraps the included styles inside @media (min-width: 768px) { ... }.
  3. Final Answer:

    .container { width: 100%; } @media (min-width: 768px) { .container { width: 750px; } } -> Option B
  4. Quick Check:

    Variable + mixin = media query wraps width: 750px [OK]
Hint: Variables inside #{} insert values in media queries [OK]
Common Mistakes:
  • Forgetting to interpolate variable with #{}
  • Placing all styles inside media query
  • Mixing order of width properties
4. What is wrong with this SASS code for responsive design?
@mixin respond {
  @media (min-width: 600px) {
    content;
  }
}

.box {
  width: 100%;
  @include respond {
    width: 600px;
  }
}
medium
A. The mixin is missing @content to insert included styles
B. The media query syntax is invalid
C. The @include should be @mixin inside .box
D. The variable for width is not defined

Solution

  1. Step 1: Check mixin body for content insertion

    The mixin uses 'content;' instead of '@content;' which is required to insert passed styles.
  2. Step 2: Understand effect on included styles

    Without '@content;', the styles inside @include respond { ... } are ignored.
  3. Final Answer:

    The mixin is missing @content to insert included styles -> Option A
  4. Quick Check:

    Missing @content means no styles inserted [OK]
Hint: Always use @content inside mixins to insert styles [OK]
Common Mistakes:
  • Writing 'content;' instead of '@content;'
  • Confusing @include and @mixin usage
  • Assuming media query syntax is wrong
5. You want to create a SASS setup that changes font size responsively for multiple components using one variable and mixin. Which approach best improves your workflow?
hard
A. Write all font sizes directly in CSS without SASS features
B. Write separate media queries inside each component without variables or mixins
C. Define a font-size variable and a respond mixin with media query; use both in components
D. Use only variables for font sizes but write media queries manually in each component

Solution

  1. Step 1: Identify reusable parts

    Using a variable for font size and a mixin for media queries lets you change values in one place.
  2. Step 2: Apply to multiple components

    Including the mixin and variable in components keeps styles consistent and easy to update.
  3. Final Answer:

    Define a font-size variable and a respond mixin with media query; use both in components -> Option C
  4. Quick Check:

    Variables + mixins = efficient responsive workflow [OK]
Hint: Combine variables and mixins for DRY responsive styles [OK]
Common Mistakes:
  • Repeating media queries in every component
  • Using variables without mixins for media queries
  • Ignoring SASS features and writing plain CSS
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard