0
0
SASSmarkup~20 mins

SASS compilation to CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SASS Compilation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the compiled CSS output?
Given this SASS code, what is the compiled CSS output?
SASS
$primary-color: #333;

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li { display: inline-block; }
  a {
    color: $primary-color;
    text-decoration: none;
  }
}
A
nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
nav li {
  display: inline-block;
}
nav a {
  color: #333;
  text-decoration: none;
}
B
nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
li {
  display: inline-block;
}
a {
  color: #333;
  text-decoration: none;
}
C
nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li {
    display: inline-block;
  }
  a {
    color: #333;
    text-decoration: none;
  }
}
D
nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  li {
    display: inline-block;
  }
  a {
    color: #333;
    text-decoration: none;
  }
}
Attempts:
2 left
💡 Hint
Remember how nested selectors compile in SASS to CSS.
🧠 Conceptual
intermediate
2:00remaining
What error occurs when compiling this SASS code?
What error will the SASS compiler produce for this code?
SASS
$font-stack: Helvetica, sans-serif
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}
AReferenceError: $font-stack is undefined
BTypeError: Cannot assign color to font property
CSyntaxError: Missing semicolon after variable declaration
DNo error, compiles successfully
Attempts:
2 left
💡 Hint
Check variable declarations carefully for punctuation.
selector
advanced
2:00remaining
Which CSS selector is generated by this SASS code?
What is the CSS selector generated by this SASS snippet?
SASS
.container {
  & > .item {
    color: red;
  }
}
A.container& > .item { color: red; }
B.container > .item { color: red; }
C&.container > .item { color: red; }
D.container .item { color: red; }
Attempts:
2 left
💡 Hint
The & symbol represents the parent selector exactly.
layout
advanced
2:00remaining
What is the visual effect of this compiled CSS?
Given this SASS and its compiled CSS, what will you see on the page?
SASS
$gap: 1rem;

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: $gap;
}
AA grid with three equal columns spaced evenly with 1rem gaps
BA grid with three columns but no gaps between items
CA flex container with three items spaced with 1rem gaps
DA block container with items stacked vertically with 1rem gaps
Attempts:
2 left
💡 Hint
Remember how CSS grid and gap properties work.
accessibility
expert
3:00remaining
Which compiled CSS best supports accessible focus outlines?
Which compiled CSS from the SASS below ensures visible focus outlines for keyboard users?
SASS
a {
  color: blue;
  &:focus {
    outline: 3px solid orange;
  }
}
A
a {
  color: blue;
  &:focus {
    outline: none;
  }
}
B
a {
  color: blue;
  outline: 3px solid orange;
}
C
a {
  color: blue;
}
a:hover {
  outline: 3px solid orange;
}
D
a {
  color: blue;
}
a:focus {
  outline: 3px solid orange;
}
Attempts:
2 left
💡 Hint
Focus outlines help keyboard users see where they are on the page.