What Is SCSS?
Which statement best describes SCSS in the context of styling web pages?
- A syntax of Sass that is fully compatible with plain CSS and compiles to standard CSS.
- A built-in feature of browsers that replaces HTML.
- A CSS framework for responsive layouts.
- A JavaScript library for building user interfaces.
- An image format used for sprites.
Declaring Variables
In the SCSS snippet `$primary: #3498db; .btn { color: $primary; }`, which symbol indicates a variable in SCSS?
- $
- @
- --
- #
- %
Selector Nesting
In the SCSS code `.nav { ul { li { a { color: red; } } } }`, what SCSS feature is being used to organize selectors hierarchically?
- Selector nesting
- Vendor prefixing
- CSS Grid layout
- Shadow DOM encapsulation
- Namespacing with @namespace
Partials and Modules
When you create a file named `_colors.scss` and reference it from another file, what is the purpose of the leading underscore in SCSS?
- It marks the file as a partial that does not generate a standalone CSS file and is intended to be loaded with @use or @import.
- It makes all variables global across all projects.
- It minifies the file automatically on save.
- It converts hex colors to RGB automatically.
- It enables special browser caching for that file.
Using Mixins
Given `@mixin center { display: flex; justify-content: center; align-items: center; } .card { @include center; }`, what does `@include center;` do in SCSS?
- It inserts the declarations from the `center` mixin into `.card`.
- It creates a new CSS variable named `center`.
- It imports a CSS file called center.css.
- It calls a JavaScript function named center().
- It extends `.card` with a placeholder selector.
Functions vs Mixins
Which SCSS feature is specifically designed to compute a value and return a single result, as in `@function ratio($w, $h) { @return $w / $h; }`?
- Functions
- Mixins
- Placeholders
- Partials
- Maps
Color Utilities
In the SCSS rule `.tag { background: lighten(#336699, 10%); }`, what does the `lighten` function do?
- It increases the lightness of the color by 10%.
- It reduces the saturation of the color by 10%.
- It makes the color 10% more transparent.
- It darkens the color by 10%.
- It converts the color to HSL format.
The Ampersand Operator
In the SCSS snippet `.btn { u0026:hover { opacity: 0.9; } u0026--primary { color: white; } }`, what does the `u0026` symbol represent?
- It refers to the current parent selector `.btn`.
- It performs a logical AND operation between selectors.
- It concatenates two files at build time.
- It resets the inheritance chain to the root.
- It is a typo and should be the `@` symbol.
Placeholders and @extend
What prefix is used in SCSS to declare a placeholder selector that is intended only for use with `@extend`, as in `%button-base { padding: 0.5rem 1rem; }`?
- %
- #
- $
- u0026
- @@
Compilation to CSS
Before a browser can use styles written in SCSS, what must happen to the SCSS files in a typical workflow?
- They must be compiled into plain CSS.
- They must be embedded directly into HTML without changes.
- They must be transpiled into JavaScript.
- They must be converted into SVG graphics.
- They must be renamed with the `.csss` extension.