For performance considerations, which CSS function can be used to move an element on the Z-axis without triggering layout or paint operations?

  • opacity: 0;
  • position: relative;
  • transform: translateZ(0);
  • z-index: 10;
To move an element on the Z-axis without triggering layout or paint operations, you can use the transform property with the translateZ(0) function. This is often used to create a new stacking context for the element, which can improve rendering performance. It doesn't affect the layout or paint and is ideal for off-screen animations or optimizing 3D transforms.

In the context of a CSS preprocessor like SASS, what does "nested rules" mean?

  • Nested rules in SASS allow you to define CSS rules within other rules using indentation, resulting in more organized and efficient CSS.
  • Nested rules in SASS involve the use of inline styles within HTML documents.
  • Nested rules in SASS mean creating circular references between styles, causing rendering errors.
  • Nested rules in SASS refer to rules that are hidden and cannot be accessed in the final CSS output.
In SASS, a CSS preprocessor, "nested rules" refer to the practice of defining CSS rules within other rules using indentation. This results in more organized and efficient CSS code, making it easier to understand and maintain. Nested rules help you avoid repetition and improve code structure.

If two conflicting styles affect an element, how does the browser decide which one to apply?

  • The style declared in the first stylesheet loaded takes precedence.
  • The style declared in the last stylesheet loaded takes precedence.
  • The style with the highest specificity is applied.
  • The style with the lowest specificity is applied.
When two conflicting styles affect an element, the browser prioritizes the style declared in the last stylesheet loaded. This is known as the "cascading" nature of CSS, where later declarations override earlier ones. Specificity comes into play only if the conflicting styles are in the same stylesheet.

In a CSS keyframe animation, what does the 0% or from keyframe represent?

  • The starting point of the animation.
  • The midpoint of the animation.
  • The end point of the animation.
  • The animation duration.
In a CSS keyframe animation, the "0%" or "from" keyframe represents the starting point of the animation. It defines the initial state of the animated element. You can set CSS properties and values for this keyframe to specify how the element should look at the beginning of the animation.

How can you specify that an animation should run in reverse order?

  • animation-direction: alternate;
  • animation-play-state: reverse;
  • animation-repeat: reverse;
  • animation-reverse: true;
To make an animation run in reverse order, you should use the animation-direction property and set it to alternate. This will cause the animation to play in the reverse direction after each iteration, creating a back-and-forth effect.

In SASS/SCSS, the ________ directive allows for the creation of reusable chunks of CSS.

  • @extend
  • @import
  • @mixin
  • @use
In SASS/SCSS, the @mixin directive allows for the creation of reusable chunks of CSS. Mixins are blocks of styles that can be included and reused in different parts of your stylesheet. They are a powerful way to keep your styles modular and maintainable.

Which pseudo-class in CSS is used to target elements based on their position in a parent element, like the first child?

  • :element-first
  • :first-child
  • :nth-element(1)
  • :parent
The :first-child pseudo-class in CSS is used to target elements that are the first child of their parent element. It is commonly used to apply styles to the first element in a list or container. This selector is useful for creating specific styles for the first child within a parent.

How would you make an animation run indefinitely in CSS?

  • Set animation-iteration to infinite.
  • Set the animation-delay property to a very large value.
  • Use animation-loop property and set it to true.
  • Use the animation-duration property and set it to infinite.
To make an animation run indefinitely in CSS, you should use the animation-duration property and set it to infinite. This property specifies the time it takes for one cycle of the animation, and when set to infinite, it ensures that the animation continues to run indefinitely.

What does the CSS property "font-display" control?

  • How much space a font file occupies on the server
  • How quickly a font is loaded and rendered on a web page
  • The color and style of text
  • The size of text
The "font-display" property in CSS controls how web fonts are displayed during loading. It's used to manage the flash of unstyled text (FOUT) or invisible text, making it an essential property for optimizing web font performance. Setting it to "swap" tells the browser to use a system font until the custom font is available, reducing FOUT.

Which property allows you to control the size of tracks in a grid layout?

  • grid-row: auto;
  • grid-template-columns;
  • grid-template-rows;
  • grid-track: size;
The property that allows you to control the size of tracks (rows and columns) in a grid layout is 'grid-template-columns' for columns and 'grid-template-rows' for rows. These properties let you define the size of the grid tracks using various units like pixels, percentages, or 'fr' units.

The ::after pseudo-element in CSS is typically used to ________.

  • create inline comments in CSS
  • insert content after the selected element
  • select the first child element
  • style the element before the selected element
The ::after pseudo-element in CSS is used to insert content after the selected element. It is commonly used for adding decorative elements or additional content after an existing element. By using the ::after pseudo-element and specifying the content property, you can dynamically generate and place content after an element without modifying the HTML structure.

You're building a website's header and you want it to stay at the top of the viewport when users scroll. Which positioning property would you use?

  • Absolute
  • Fixed
  • Relative
  • Static
To keep the header at the top of the viewport when users scroll, you should use the "position: fixed" property. This makes the element's position relative to the browser window, ensuring it stays in place while the page content scrolls beneath it.