What does the currentColor value represent in CSS?

  • The color currently being used for link text.
  • The color of the element's border.
  • The computed color value for text inside an element.
  • The current background color of an element.
The currentColor value in CSS represents the computed color value for text inside an element. It allows you to set properties like border or padding to the same color as the text content, ensuring consistent styling.

You've been asked to ensure that a custom web font falls back to a system font if it doesn't load within 3 seconds. How would you implement this?

  • Implement a custom JavaScript script.
  • Use the @font-face rule with a timeout attribute.
  • Use the font-display property with the value fallback.
  • Use the font-stack property.
To ensure that a custom web font falls back to a system font if it doesn't load within a specific time frame, you can use the font-display property with the value fallback. This CSS property controls how font faces are displayed and allows you to specify fallback behavior. When set to fallback, the browser will switch to the system font if the custom font doesn't load within the specified time, which is the desired behavior in this scenario.

When an element with position: absolute; is inside a positioned ancestor, to which element will it be positioned relative?

  • To the nearest sibling element.
  • To the parent element.
  • To the top of the document.
  • To the viewport.
When an element with 'position: absolute;' is inside a positioned ancestor, it will be positioned relative to its closest positioned ancestor. If there is none, it will be positioned relative to the viewport (the browser window).

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.

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 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.

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.

How can you ensure that the animation effects persist after the animation completes its execution?

  • By adding "animation-play-state: running;"
  • By setting "animation-direction" to "alternate."
  • By setting the "animation-fill-mode" property to "forwards."
  • By using "animation-iteration-count: infinite."
To ensure that the animation effects persist after the animation completes, you should set the "animation-fill-mode" property to "forwards." This will make the animation retain its final state after completing its execution.

Which CSS property is used to create animations by gradually changing from one set of CSS styles to another?

  • animate
  • animate-duration
  • animation-duration
  • keyframes
The CSS property used to create animations by gradually changing from one set of CSS styles to another is keyframes. Keyframes are used to define a sequence of style changes over a specified duration using the @keyframes rule. The animation duration can be controlled by the animation-duration property.

You have a style rule with a class selector that is not being applied, even though another rule with three type selectors is applied to the same element. What could be the reason based on specificity?

  • Class selectors have higher specificity than type selectors.
  • Specificity is not a factor in CSS rule application.
  • The order of the rules in the stylesheet determines the application.
  • Type selectors have higher specificity than class selectors.
In CSS, class selectors have higher specificity than type selectors. Therefore, if a class selector rule is not being applied, but a rule with three type selectors is, it's likely because the class selector rule has a lower specificity.