Which modular CSS methodology uses the Block, Element, Modifier structure?

  • BEM (Block, Element, Modifier)
  • ITCSS (Inverted Triangle CSS)
  • OOCSS (Object-Oriented CSS)
  • SMACSS (Scalable and Modular Architecture for CSS)
The modular CSS methodology that uses the Block, Element, Modifier structure is BEM, which stands for Block, Element, Modifier. BEM is a naming convention that helps create maintainable and predictable CSS code by organizing styles into blocks, elements, and modifiers.

While using a CSS preprocessor, you notice that the compiled CSS has selectors that are excessively long and specific. What might be a potential cause for this in your source files?

  • Overuse of nesting in SASS or LESS
  • Lack of CSS optimization tools
  • Errors in the preprocessor settings
  • Incorrect order of imported stylesheets
Excessively long and specific selectors in compiled CSS are often caused by overusing nesting in preprocessors like SASS or LESS. While nesting can improve code organization, it can also lead to overly specific selectors that increase file size and reduce maintainability.

The primary purpose of functions in SASS is to ________.

  • Calculate mathematical expressions
  • Create loops
  • Define variables
  • Group CSS properties
The primary purpose of functions in SASS is to calculate mathematical expressions. SASS functions can perform various mathematical operations, making it easy to compute values for CSS properties dynamically. They are valuable for maintaining consistency and making stylesheets more maintainable.

To create a shadow effect behind an element, you'd use the ________ filter.

  • blur
  • drop-shadow
  • glow
  • shadow
To create a shadow effect behind an element in CSS, you'd use the drop-shadow filter. This filter adds a shadow to an element, allowing you to control its position, color, and blur.

What is the main purpose of media queries in CSS?

  • To add multimedia elements like images and videos
  • To apply different styles based on user interactions
  • To change the color scheme of a webpage
  • To modify the layout and design of a webpage based on the device's characteristics, such as screen size and orientation
Media queries in CSS are primarily used for creating responsive web design. They allow web developers to adapt the layout and styling of a webpage based on the characteristics of the device, such as screen width, height, and orientation. This is essential for ensuring a consistent and user-friendly experience across various devices, from desktops to mobile phones.

If you want an animation to alternate between running forwards and backwards, you would use the animation-direction value of ______.

  • alternate
  • alternate-reverse
  • repeat
  • reverse
To make an animation alternate between running forwards and then backwards, you would use the value alternate for the animation-direction property. This creates a back-and-forth effect for the animation, making it appear as if it's reversing after each cycle.

You have an element inside a container. The container has a font-size of 20px. If you set the child element's font-size to 1.5em, what will be its computed font-size?

  • 10px
  • 15px
  • 20px
  • 30px
When you set the child element's font-size to 1.5em, it multiplies the parent element's font-size. In this case, 1.5em x 20px = 30px. So, the computed font-size of the child element will be 30px.

Which CSS property defines the number of times an animation should run?

  • animation-iteration
  • animation-iteration-count
  • animation-loop
  • animation-repeat
The CSS property that defines the number of times an animation should run is animation-iteration-count. By specifying a value, such as an integer or "infinite," you can control how many times the animation repeats. This property is essential for creating looping animations with a specific number of iterations or an indefinite loop.

You're designing a webpage where you want to ensure that the distance between lines of text is 1.5 times the size of the text. How would you achieve this using CSS?

  • line-height: 1.5em;
  • line-height: 1.5x;
  • line-height: 150%;
  • line-spacing: 1.5;
To ensure that the distance between lines of text is 1.5 times the size of the text, you can use the line-height property in CSS. You can set it to 150%, which is equivalent to 1.5 times the font size. Alternatively, you can use line-height with an em value, like 1.5em, which achieves the same effect.

The backface-visibility property in CSS is particularly useful when ________.

  • applying transitions
  • creating 3D transformations
  • creating responsive layouts
  • using media queries
The backface-visibility property in CSS is particularly useful when creating 3D transformations. When set to hidden, it prevents the back side of an element from being visible, which is essential for 3D transformations where the front and back of an element should not be visible simultaneously.