The CSS unit ______ is equivalent to the computed value of the font-size of the element's parent.

  • rem
  • em
  • px
  • vw
The correct option is 'rem.' The 'rem' unit represents the font-size of the root element (html), providing a scalable way to set sizes based on the base font size of the document.

How do CSS sprites help in improving website performance?

  • By adding more images to the website
  • By increasing the file size of individual images
  • By reducing the number of server requests for images
  • By removing all images from the website
CSS sprites combine multiple images into a single image, reducing the number of server requests. This leads to faster loading times as the browser only needs to download one image instead of multiple, especially beneficial for small icons and background images.

A developer is tasked with creating a navigation menu where each list item has a custom icon instead of the default marker. How can they achieve this using CSS properties related to list styles?

  • list-style-type: none; background-image: url('icon.png'); background-size: 20px 20px; background-repeat: no-repeat; padding-left: 30px;
  • list-style-type: none; content: url('icon.png'); padding-left: 30px;
  • list-style: none; background-image: url('icon.png'); background-size: 20px 20px; background-repeat: no-repeat; padding-left: 30px;
  • list-style-type: none; background: url('icon.png') no-repeat left center; padding-left: 30px;
Option 4 is correct. It sets list-style-type to none and uses a background image for the custom icon, adjusting padding for spacing.

To override a CSS Variable in a specific context, you must define it within a ________ selector to increase its specificity.

  • class
  • specific
  • media
  • nested
The correct option is class. To override a CSS variable in a specific context, you should define it within a class selector. This increases the specificity of the selector, ensuring that the variable is applied within that specific scope, overriding any global variable with the same name.

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

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.

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.

In Styled Components, the global styles that apply to the entire application are defined using the ________ helper function.

  • applyGlobalStyles
  • createGlobalStyle
  • defineGlobalStyles
  • setGlobalStyles
The createGlobalStyle helper function in Styled Components is used to define global styles that apply to the entire application, ensuring consistent styling across components and pages.

A developer wants to create a text container that breaks into three columns on wide screens but remains a single column on small devices. Which CSS property combination should be used to achieve this responsive multi-column layout?

  • column-count: 3; column-width: auto;
  • columns: 3 auto;
  • flex: 1 0 33%;
  • grid-template-columns: repeat(3, 1fr);
To achieve a responsive multi-column layout, using the grid-template-columns property with repeat ensures three columns on wide screens while maintaining a single column on small devices.

How does the color property in CSS affect an HTML element?

  • Controls the spacing between elements
  • Defines the background color
  • Sets the font color
  • Specifies the color of the border
The color property in CSS is used to set the font color of an HTML element. It affects the text content within the element, allowing you to choose from various color representations.

What are the potential pitfalls of using floats for layout purposes in modern web design?

  • Clearing floats using the "clearfix" hack
  • Floats can cause a lack of flexibility in responsive design
  • Floats can create a complex layout structure
  • Floats can lead to issues with vertical alignment
The use of floats for layout can lead to challenges such as clearing issues and difficulties with vertical alignment. These pitfalls should be considered when choosing layout techniques in modern web design.