0
0
SASSmarkup~20 mins

Offset class generation in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Offset Class 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 code?
Given the following SASS code, what CSS does it generate for the .offset-3 class?
SASS
@for $i from 1 through 5 {
  .offset-#{$i} {
    margin-left: #{($i * 10)}%;
  }
}
A.offset-3 { margin-left: 3%; }
B.offset-3 { margin-left: 30%; }
C.offset-3 { margin-left: 300%; }
D.offset-3 { margin-left: 0; }
Attempts:
2 left
💡 Hint
Think about how the loop multiplies the index by 10 to get the margin-left value.
🧠 Conceptual
intermediate
1:30remaining
Which SASS feature allows generating multiple offset classes efficiently?
You want to create offset classes from .offset-1 to .offset-12 with increasing margin-left values. Which SASS feature helps you do this without writing each class manually?
AUsing variables to store margin values only
BUsing @import to include multiple files
CUsing @extend to inherit styles from a base class
DUsing a @for loop to iterate through numbers and generate classes
Attempts:
2 left
💡 Hint
Think about repeating code with different numbers.
selector
advanced
1:30remaining
Which selector matches all offset classes generated by this SASS code?
Consider this SASS snippet generating offset classes: @for $i from 1 through 12 { .offset-#{$i} { margin-left: #{($i * 8.3333)}%; } } Which CSS selector will select all these offset classes in a stylesheet?
A.offset
B.offset-*
C[class^="offset-"]
D.offset-
Attempts:
2 left
💡 Hint
Look for a selector that matches class names starting with a pattern.
layout
advanced
1:30remaining
How does using offset classes affect a Flexbox layout?
You have a Flexbox container with children. You apply .offset-2 class to one child, which adds margin-left: 16.6666%. What is the visual effect on that child in the Flexbox layout?
AThe child shifts right by 16.6666% of the container width, creating space before it
BThe child shrinks to 16.6666% width
CThe child moves left by 16.6666%
DThe child overlaps the previous sibling
Attempts:
2 left
💡 Hint
Margin-left pushes the element away from the left edge.
accessibility
expert
2:00remaining
What accessibility consideration is important when using offset classes for layout?
When offset classes add margin-left to shift content visually, what should you ensure for screen reader users and keyboard navigation?
AThe visual offset does not change the logical reading order or tab order
BThe offset classes add aria-hidden attributes to shifted elements
CThe offset classes use absolute positioning to move elements
DThe offset classes remove focus outlines to improve appearance
Attempts:
2 left
💡 Hint
Think about how screen readers read content and how keyboard users navigate.