Which value of animation-fill-mode ensures the animation's styles are applied before the animation begins?

  • backwards
  • both
  • forwards
  • none
The value of animation-fill-mode that ensures the animation's styles are applied before the animation begins is backwards. When you set animation-fill-mode to backwards, the element retains the styles of the first keyframe until the animation begins. This can be useful to set initial styles before the animation starts.

In a responsive design, you have a sidebar that should stick to the top after scrolling past its initial position but stop sticking when it reaches the footer. Which positioning property would you apply to the sidebar?

  • Absolute
  • Fixed
  • Relative
  • Sticky
To create a sidebar that sticks to the top after scrolling past its initial position but stops sticking when it reaches the footer, you should apply the "position: sticky" property. It maintains the element's natural position until a specified scrolling threshold is reached, and then it behaves as if it were fixed.

What does the "forwards" value for the "animation-fill-mode" property do?

  • It makes the animation continue in its final state after completion.
  • It repeats the animation indefinitely.
  • It reverses the animation direction.
  • It sets the animation to be paused.
The "forwards" value for the "animation-fill-mode" property makes the animation continue in its final state after completion. It ensures that the final keyframe of the animation is retained as the end state even after the animation completes.

The CSS function ______ allows you to perform arithmetic calculations directly within your stylesheets.

  • arithmetic()
  • calc()
  • compute()
  • math()
The correct CSS function that enables you to perform arithmetic calculations directly within your stylesheets is calc(). This function is particularly useful for dynamically adjusting styles based on calculations, making it a powerful tool for responsive design and layout adjustments.

SCSS functions can be used to perform ________ before the CSS is compiled.

  • Code execution
  • Conditional statements
  • Looping operations
  • Mathematical calculations
SCSS functions can be used to perform mathematical calculations, such as addition, subtraction, and multiplication, before the CSS is compiled. This allows you to generate dynamic and responsive styles based on input values.

You are developing a website where you want to use modern CSS features not yet supported in all browsers. How can you ensure compatibility without manually writing fallbacks?

  • Use a CSS preprocessor like SASS
  • Employ a PostCSS plugin
  • Write conditional JavaScript code
  • Ignore unsupported features
To ensure compatibility with modern CSS features, you can use a PostCSS plugin like "autoprefixer" that automatically generates fallback code for unsupported features, allowing you to write modern CSS with confidence. This minimizes the need for manual fallbacks.

You are tasked with creating a list where every even item has a gray background. Which CSS selector would help you accomplish this?

  • :even
  • :nth-child(even)
  • :nth-child(odd)
  • :odd
To select every even item in a list, you should use the :nth-child(even) selector. This will apply the styling to the elements with even indices in the list, which will give them a gray background in this scenario.

What is the role of the grid-gap property in a grid layout?

  • It defines the number of columns in the grid.
  • It determines the background color of the grid.
  • It sets the width of the entire grid.
  • It specifies the gap between grid items.
The grid-gap property is used to specify the gap or spacing between grid items (rows and columns) in a grid layout. It helps in controlling the spacing and alignment of items within the grid.

What does the ::before pseudo-element do in CSS?

  • It creates a pseudo-element that is the first child of the selected element, allowing content to be generated before the actual content of the element.
  • It selects the element that comes after the targeted element.
  • It selects the first child element of the parent element.
  • It targets the element that is immediately before the current element.
The ::before pseudo-element in CSS is used to generate content before the content of an element. It creates an element that appears as the first child of the selected element and allows you to insert generated content (such as text or images) before the actual content of the element.

In CSS, if you want an element to inherit a property's value from its parent element, you would use the value ________.

  • Copy
  • Inherit
  • Override
  • Override-all
To make an element inherit a property's value from its parent element, you would use the 'inherit' value. This ensures that the child element inherits the property value from its parent.