Which CSS property is used to set the perspective from which an element is viewed?

  • element-perspective
  • perspective
  • perspective-view
  • view-perspective
The correct CSS property is perspective, which sets the depth of the view for 3D transformed elements. It determines how far the element is placed from the viewer.

In BEM methodology, the __ (double underscore) is used to denote a(n) ________ of a block.

  • --, Element
  • --, Modifier
  • __, Element
  • __, Modifier
In BEM, the double underscore (__) is used to denote a Modifier of a block, allowing for clear and structured class naming.

In mobile-first design, the use of ________ media queries is essential for adapting the layout for larger screens.

  • device-width
  • max-width
  • min-width
  • screen-size
Mobile-first design involves using min-width media queries to adapt the layout for larger screens. This approach prioritizes styles for small screens and uses media queries to progressively enhance the design as the screen size increases. Understanding the use of max-width is crucial for responsive web design.

The position: ________ property creates a new stacking context and positions an element in relation to the browser viewport.

  • absolute
  • fixed
  • relative
  • static
The position: absolute property creates a new stacking context and positions an element relative to its nearest positioned ancestor or to the containing block. This is useful for precise positioning within the document structure.

What is the purpose of using the 'lang' attribute in HTML in the context of internationalization?

  • Defining the layout direction for right-to-left languages
  • Determining the character encoding for proper text rendering
  • Enabling automatic translation for non-native speakers
  • Specifying the language of the content
The 'lang' attribute in HTML is used to specify the language of the content, aiding in internationalization. It helps screen readers pronounce text correctly, enables language-specific styling, and assists in translation for a more inclusive and globally accessible web.

What is the @media rule in CSS used for?

  • Applying styles to specific elements
  • Creating animations
  • Defining media queries for responsive design
  • Importing external stylesheets
The @media rule is used for defining media queries in CSS. Media queries allow you to apply different styles for different devices or screen sizes, enabling the creation of responsive designs. It is not used for applying styles directly to elements, creating animations, or importing external stylesheets.

For advanced CSS3 features like transitions and transforms, the ________ vendor prefix is required for older versions of Firefox.

  • -moz-
  • -webkit-
  • -o-
  • -ms-
The correct option is -moz-. Older versions of Firefox require the Mozilla vendor prefix for advanced CSS3 features like transitions and transforms. This helps maintain compatibility with legacy browser versions.

Which CSS property adds shadow to text?

  • box-shadow
  • font-shadow
  • shadow-color
  • text-shadow
The text-shadow property is used to add a shadow to text in CSS. It takes values for horizontal and vertical shadow offsets, blur radius, and shadow color.

A developer is optimizing a website for faster load times. They notice that the CSS is blocking the rendering of the page. What strategy should they employ to reduce render-blocking CSS?

  • Inline critical CSS
  • Load CSS files in the
  • Minify and combine CSS files
  • Use asynchronous loading for CSS
When optimizing for faster load times, using asynchronous loading for CSS allows the page to render without waiting for the CSS to fully load, improving the initial rendering speed.

A website uses several custom fonts, which significantly increase its load time. What CSS technique can be employed to reduce the impact on the website's performance while maintaining font aesthetics?

  • Font Base64 Encoding
  • Font Preloading
  • Font Spriting
  • Font Subsetting
When a website uses several custom fonts, Font Preloading can be employed to reduce the impact on performance. This technique allows the browser to load fonts in the background, minimizing the delay in rendering text.