Challenge - 5 Problems
Sass Partial Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why do Sass partial files start with an underscore?
In Sass, partial files often start with an underscore (e.g.,
_variables.scss). What is the main reason for this naming convention?Attempts:
2 left
💡 Hint
Think about how Sass handles files when compiling.
✗ Incorrect
Sass uses the underscore prefix to identify partial files. These files are not compiled into separate CSS files but are meant to be included in other Sass files.
📝 Syntax
intermediate2:00remaining
Importing a Sass partial file
Given a partial file named
_mixins.scss, which import statement correctly includes it in styles.scss?SASS
/* styles.scss */ @import ???;
Attempts:
2 left
💡 Hint
When importing, you don't need to include the underscore or file extension.
✗ Incorrect
Sass allows importing partials by their name without the underscore or file extension. So '@import 'mixins';' correctly imports '_mixins.scss'.
❓ rendering
advanced2:00remaining
Output CSS from partial files
If you have two Sass files:
_reset.scss and main.scss which imports _reset.scss, what CSS files will be generated after compiling?Attempts:
2 left
💡 Hint
Remember what the underscore means for partial files.
✗ Incorrect
Partial files starting with an underscore are not compiled into CSS files on their own. Only the main file that imports them is compiled into CSS.
❓ selector
advanced2:00remaining
Using partials to organize selectors
You have a partial file
_buttons.scss with styles for buttons. How should you organize your Sass files to keep your project clean and maintainable?Attempts:
2 left
💡 Hint
Think about how partials help organize code.
✗ Incorrect
Using partials like '_buttons.scss' helps keep styles modular and easier to manage. Importing them into a main Sass file keeps the project organized.
❓ accessibility
expert3:00remaining
Accessibility considerations when using Sass partials
When using Sass partials to style components, what is an important accessibility practice to keep in mind?
Attempts:
2 left
💡 Hint
Accessibility often involves color contrast and readability.
✗ Incorrect
Using variables in partials for colors helps maintain consistent and accessible color contrast across the site, improving readability for all users.