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.

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 does the transform-origin property affect a transformed element in CSS?

  • Defines the axis of rotation for the transformed element.
  • Determines the position of the transformed element within its parent.
  • Sets the scaling factor for the transformed element.
  • Specifies the origin of the transformation relative to the element's border box.
The transform-origin property sets the origin for transformations, such as rotations or scaling. It defines a point around which the transformation is applied, specified in terms of percentages or length values.

To control the width of the columns in a multi-column layout, the CSS property used is column-width: ________.

  • width
  • column-size
  • column-width
  • column-length
The correct option is column-width. This property specifies the width of the columns in a multi-column layout. It can take values such as length, percentage, or the 'auto' keyword to determine the width of the columns.

When designing a website, a developer uses multiple classes and ID selectors within their stylesheet. They notice that changes to some class styles are not taking effect. What might be the reason based on specificity rules?

  • High specificity of the ID selectors
  • Low specificity of the class selectors
  • Presence of universal (*) selector
  • Use of pseudo-classes in the stylesheet
Specificity rules in CSS dictate that ID selectors have higher specificity than class selectors. If changes to class styles are not taking effect, it may be because the ID selectors in the stylesheet have higher specificity, causing them to override the class styles. Understanding specificity is essential for resolving styling conflicts.

CSS Houdini's ________ API allows developers to define custom CSS properties that can be used in standard CSS files.

  • Custom
  • Layout
  • Paint
  • Properties and Values
CSS Houdini's Properties and Values API enables developers to define custom CSS properties, providing more control and extensibility to styles in standard CSS files.

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.

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.

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.

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.