In SASS/SCSS, what is the primary difference between a mixin and a function?

  • Functions are used for reusable styles, while mixins are for reusable logic
  • Functions can be called multiple times within a rule, but mixins cannot
  • Mixins can accept arguments, but functions cannot
  • Mixins can produce CSS rules, but functions cannot
The primary difference between a mixin and a function in SASS/SCSS is that functions are used for reusable styles and can return values, while mixins are used for reusable logic and can generate CSS rules. Mixins can accept arguments, which allows for more dynamic behavior, whereas functions are typically used for calculations and value generation.

What is the primary goal of the OOCSS (Object-Oriented CSS) methodology?

  • To apply styles globally
  • To eliminate the need for HTML
  • To make CSS more complex
  • To separate content and layout
The primary goal of the OOCSS (Object-Oriented CSS) methodology is to separate content and layout. OOCSS promotes creating reusable and modular CSS classes that can be applied to various elements in a layout, separating the styling from the content. This improves maintainability and promotes a more organized CSS structure.

Which of the following CSS combinators targets a direct child element?

  • *
  • +
  • >
  • ~
The ">" combinator is used to target a direct child element, ensuring that styles are applied only to the immediate child and not to nested descendants.

The ______ property in CSS lets you apply a delay before an animation starts.

  • animation-delay
  • animation-pause-delay
  • animation-start-delay
  • transition-delay
The property in CSS that allows you to apply a delay before an animation starts is the animation-delay. This property is used to create a pause before the animation begins, which is especially useful for sequencing animations.

You are tasked with ensuring that all hyperlinks have no underlines but should be underlined when hovered over. How would you implement this using CSS?

  • a { text-decoration: none; } a:hover { text-decoration: underline; }
  • a { text-decoration: underline; }
  • a { text-decoration: underline; } a:hover { text-decoration: none; }
  • a:hover { text-decoration: underline; }
To ensure that hyperlinks have no underlines by default but are underlined when hovered over, you should use the CSS rule a { text-decoration: none; } to remove the underlines from all anchor elements and then use a:hover { text-decoration: underline; } to specify that underlines should appear when the link is hovered.

OOCSS primarily focuses on separating container and content, and promoting the reuse of ________.

  • CSS rules
  • HTML elements
  • JavaScript functions
  • Styles
Object-Oriented CSS (OOCSS) emphasizes separating the container and content in your styles and promoting the reuse of styles (i.e., CSS rules). This approach helps keep your CSS modular, making it easier to maintain and reducing redundancy in your code.

When using Styled Components, how would you dynamically change the style of a component based on its props?

  • Create separate component variants for each style and switch between them using conditional rendering.
  • Styled Components do not support dynamic style changes based on props.
  • Use the class prop to assign different CSS classes based on prop values.
  • Use the style prop to pass in an inline CSS object and conditionally apply styles based on prop values.
In Styled Components, you can dynamically change the style of a component based on its props by using the style prop. You can pass in an inline CSS object and conditionally apply styles based on the values of the props. This allows for the creation of versatile and reusable components.

What is the default value of the box-sizing property in CSS?

  • border-box
  • content-box
  • margin-box
  • padding-box
The default value of the 'box-sizing' property in CSS is 'content-box.' In this mode, the width and height of an element do not include padding or borders, only the content is considered. This can sometimes lead to unexpected layout behavior, which is why 'border-box' is often preferred.

What would be the primary reason to avoid excessive nesting in SASS or SCSS?

  • Excessive nesting can lead to increased file size
  • It helps with better code organization
  • It improves the performance of stylesheets
  • It is a recommended best practice
Excessive nesting in SASS or SCSS can lead to bloated and inefficient CSS files, which are larger in size. This negatively impacts loading times and page performance. It is advisable to avoid deep nesting to keep the stylesheet lean and maintainable.

A font's loading performance can be improved by ________.

  • compression
  • inlining
  • minifying
  • preloading
A font's loading performance can be improved by "preloading." Preloading involves using the link element in the HTML to fetch and cache font files in advance, reducing the time it takes to load and render text with custom fonts.