In what scenario might the !important rule be considered bad practice?

  • In a large and complex stylesheet.
  • In a small, isolated project with minimal styles.
  • When it is applied to critical layout styles.
  • When it is used to fix specificity issues.
Using the !important rule in a large and complex stylesheet can make it challenging to maintain and debug. It should be avoided as a general practice to maintain a clear and predictable style hierarchy.

What is the purpose of nesting in CSS preprocessors like SASS?

  • Improved readability and organization of styles by nesting selectors within each other.
  • To create hierarchical relationships between styles for better structure.
  • To eliminate the need for specificity in selector targeting.
  • To override global styles easily by encapsulating rules within specific blocks.
Nesting in CSS preprocessors like SASS aims to enhance the readability and organization of styles by allowing the nesting of selectors within each other. This feature is beneficial for creating a clear and hierarchical structure in the stylesheet, making it easier to understand the relationships between different elements and their respective styles.

How can CSS be used to enhance the focus visibility for keyboard users?

  • Applying a background color change on focus
  • Implementing the :focus pseudo-class
  • Increasing font size for focused elements
  • Using JavaScript to handle keyboard events
CSS can enhance focus visibility by applying a background color change on focus, making it more noticeable for keyboard users. This improves the overall user experience for those navigating through a website using a keyboard.

How can the improper use of custom fonts negatively impact accessibility on a website?

  • Custom fonts may increase page load time
  • Custom fonts may lack proper contrast
  • Custom fonts may not be supported on mobile devices
  • Custom fonts may not load quickly
The improper use of custom fonts, especially when they lack proper contrast, can make text difficult to read, negatively impacting accessibility for users with visual impairments. It's crucial to choose fonts with good contrast and ensure proper implementation for better accessibility.

Which CSS property is used to change the text color of an element?

  • color
  • font-color
  • style-color
  • text-color
The correct CSS property to change the text color of an element is 'color.' It allows you to specify the desired color using various formats like named colors, hexadecimal, or RGB values.

In a multi-column layout, which CSS property is used to control the gap between columns?

  • column-gap
  • gap
  • margin
  • padding
The column-gap property is used to control the gap between columns in a multi-column layout.

The only way to override an inline style from a stylesheet is to use the ________ rule or use a more specific selector.

  • !important
  • cascade
  • inherit
  • override
In CSS, the cascade rule is the only way to override an inline style from a stylesheet. It follows the order of specificity, and a more specific selector will take precedence.

What is the main difference in using minmax() in CSS Grid as opposed to using media queries for responsive designs?

  • Media queries are limited to adjusting colors and backgrounds.
  • Media queries are more suitable for fixed-size layouts.
  • minmax() is specific to adjusting font sizes responsively.
  • minmax() is used for creating flexible layouts within a grid container.
Using minmax() in CSS Grid allows you to create flexible layouts by defining a size range for grid tracks. This is more dynamic than media queries, which are typically used for fixed-size layouts. minmax() provides adaptability within a specified range, making it a powerful tool for responsiveness in grid-based designs.

Which file format is commonly used for icon fonts in web development?

  • PNG
  • SVG
  • TTF
  • WOFF
WOFF (Web Open Font Format) is a commonly used file format for icon fonts in web development. It provides better compression and is specifically designed for efficient delivery of fonts on the web.

How can CSS be used to implement a sticky header that remains at the top of the viewport during scrolling?

  • Position: sticky;
  • Position: fixed;
  • Position: relative;
  • Position: absolute;
The correct option is Position: sticky;. This CSS property is used to create a sticky element that remains fixed at the top of the viewport during scrolling. It is often used for headers or navigation bars. Position: fixed; would also keep the element fixed but without regard to its parent container. Position: relative; and Position: absolute; have different behaviors in relation to the normal flow of the document.