For accessibility, using ________ in CSS can provide better control over how elements are read by screen readers.

  • accessibility-control:
  • aria-label:
  • role:
  • sr-only:
To enhance accessibility, using sr-only in CSS is beneficial. It helps provide better control over how elements are read by screen readers by visually hiding elements while keeping them accessible. aria-label and role are attributes used in HTML for accessibility, not CSS properties. accessibility-control is not a valid CSS property.

CSS Houdini is primarily aimed at allowing developers to do what?

  • Automate the generation of HTML structure
  • Extend and enhance the capabilities of the CSS engine
  • Minify and compress CSS files
  • Standardize CSS syntax across browsers
CSS Houdini is designed to extend and enhance the capabilities of the CSS engine, allowing developers to have more control and flexibility in styling web elements.

In a scenario where an animation should only play when an element is visible on the screen, what CSS or JavaScript features can be used to accomplish this?

  • Intersection Observer API
  • opacity, display, on-screen-check
  • scroll-event, play-animation
  • visibility, animation-delay
To play an animation only when an element is visible on the screen, the developer can use the Intersection Observer API in JavaScript. This API detects when the target element enters or exits the viewport, allowing for precise control over animation triggers.

A web developer notices that a CSS animation is not working in Safari but functions correctly in Chrome and Firefox. What is the first step they should take to troubleshoot this issue?

  • Check for browser-specific CSS prefixes
  • Ensure the browser supports the animation type
  • Examine browser developer tools for errors
  • Verify the CSS animation syntax
In this scenario, checking the browser developer tools for errors is crucial. It helps identify any specific issues or error messages that can guide the developer in fixing the problem. Different browsers may have different requirements or interpretations of CSS animations, and examining the developer tools can provide insights into the exact cause of the issue.

In CSS Flexbox, which property is used on the container to align items horizontally?

  • justify-content
  • align-items
  • flex-align
  • flex-container
The correct option is justify-content. This property is used to align items along the main axis (horizontally in a row layout) in a flex container.

When using position: sticky;, which two properties must be set for the sticky behavior to work effectively?

  • top
  • left
  • position
  • display
The correct options for the position: sticky; to work effectively are position: sticky; and top. The position property must be set to sticky, and the top property should be defined to specify the position where the element becomes sticky.

You're designing a web application that requires certain elements to be draggable within the confines of a specific area. Which combination of positioning and other CSS properties will you need to consider?

  • position: absolute, top: 0, left: 0; z-index: 1;
  • position: fixed; width: 100%; height: 100%;
  • position: relative; overflow: hidden;
  • position: sticky, bottom: 0, right: 0;
To create draggable elements within a specific area, you should use position: relative on the container and set overflow: hidden. This allows the absolute-positioned elements to be confined within the container.

What distinguishes CSS Houdini's Animation Worklet from traditional CSS animations?

  • Animation Worklet only supports basic transition animations.
  • Animation Worklet provides a JavaScript API to create complex animations outside the main thread.
  • Traditional CSS animations are limited to predefined easing functions.
  • Traditional CSS animations are more performant and have better browser compatibility.
CSS Houdini's Animation Worklet introduces a JavaScript API that enables the creation of complex animations outside the main thread, offering greater control and performance compared to traditional CSS animations.

How would you create a transparent border that doesn't affect the layout dimensions of a box?

  • border: 1px solid transparent;
  • border: 1px transparent solid;
  • border: transparent 1px solid;
  • transparent: border 1px solid;
To create a transparent border that doesn't affect the layout dimensions, you can use the border property with a transparent color value. This ensures that the border is there visually but does not take up any additional space in the layout.

Media queries are typically written using the @________ rule in CSS.

  • import
  • media
  • query
  • screen
Media queries in CSS are written using the @media rule. This rule is used to apply different styles for different devices and conditions, allowing for responsive design.