What role does CSS play in ensuring that websites are usable by people with color vision deficiencies?

  • Adjusting color contrast for better readability
  • Providing alternative text for images
  • Using semantic HTML elements for better structure
  • Utilizing media queries to adapt styles based on user preferences
CSS plays a crucial role in ensuring websites are usable for people with color vision deficiencies by adjusting color contrast. This helps improve readability and ensures content is accessible to a wider audience.

What is the significance of the font-display CSS property when using custom fonts?

  • Controls how a custom font is displayed during loading
  • Defines the font size for different screen resolutions
  • Sets the font style for italicizing
  • Specifies the color of the font during rendering
The font-display property in CSS is crucial when using custom fonts as it determines how the font is displayed during the loading process. It allows developers to control the fallback behavior and enhance the user experience, especially when the custom font is still loading.

When considering internationalization, what is a key consideration for typography and character sets in CSS?

  • Applying text-transform for consistent case
  • Choosing decorative fonts for better aesthetics
  • Ensuring proper encoding and font support
  • Using inline styles for better control
A key consideration for typography and character sets in CSS when considering internationalization is ensuring proper encoding and font support. This ensures that the content displays correctly for users across different languages and regions, avoiding issues with character rendering and readability.

The CSS property transform: scale(________); is used to double the size of an element.

  • 1
  • 1.5
  • 2
  • 0.5
The correct option is 2. The transform property with the scale function is used to resize elements, and a value of 2 doubles the size.

How would you create a shadow effect that suggests a light source coming from the top right corner of the element?

  • box-shadow: -5px -5px 10px #888888;
  • box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 5px 5px 10px #888888;
  • box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  • box-shadow: 5px 5px 10px #888888;
To create a shadow effect suggesting a top-right light source, you use positive values for the horizontal and vertical offsets in the box-shadow property. This casts a shadow to the bottom right, simulating light from the top right.

The vendor prefix ________ is used for CSS properties in Chrome and Safari browsers.

  • -moz-
  • -ms-
  • -o-
  • -webkit-
Vendor prefixes are used to enable browsers to support experimental or proprietary CSS properties. In this case, -webkit- is used for Chrome and Safari browsers.

When applying margin: auto to an element, under which conditions will it center the element horizontally?

  • The element must be a block-level element.
  • The element must have a fixed width.
  • The element must have a margin set to auto on both the left and right sides.
  • The element must have a position property set to absolute.
Margin: auto centers an element horizontally when the left and right margins are set to auto. It is essential to ensure that the element has a specified width, enabling the auto margins to distribute the remaining space equally. Understanding these conditions is key to effectively centering elements using CSS.

What is the main limitation of CSS Variables when compared to SASS Variables in terms of preprocessing?

  • Lack of dynamic variable capabilities
  • Lack of global variables
  • Limited browser support
  • Limited scope
CSS Variables lack some dynamic features compared to SASS Variables. While SASS allows for dynamic variable names and values, CSS Variables are more static and have a limited scope.

If you set the font-size to 2rem, how is this size calculated relative to the root element's font size?

  • Twice the root element's font size
  • Two times the computed font size
  • Two times the initial font size
  • Two times the parent element's font size
When using 'rem' unit, the font size is calculated relative to the root element's font size. In this case, 2rem means two times the root element's font size. Understanding this relationship is crucial for responsive design.

How does inheritance affect element styling in CSS?

  • Child elements inherit styles from parent
  • Inheritance has no impact on styling
  • Parent elements inherit styles from children
  • Styles are inherited randomly
In CSS, child elements inherit styles from their parent elements, establishing a hierarchy of styles.