โ† All CSS Flashcard Decks

(Layout & Images) Flashcards

7 cards from real CSS practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 (Layout & Images) flashcards as text
  1. Which CSS property creates a grid container?

    Answer: display: grid

    Setting display: grid on an element turns it into a grid container.

  2. What does the 'object-fit: cover' value do to an image?

    Answer: Scales it to fill the box while keeping aspect ratio, cropping overflow

    object-fit: cover fills the content box while preserving aspect ratio, cropping any excess.

  3. Which property sets the spacing between flex items?

    Answer: gap

    The gap property defines spacing between flex (and grid) items.

  4. What value of 'position' removes an element from normal flow and positions it relative to the nearest positioned ancestor?

    Answer: absolute

    position: absolute removes the element from flow and anchors it to the nearest positioned ancestor.

  5. Which CSS function lets you define a responsive image size that scales between a minimum and maximum?

    Answer: clamp()

    clamp() sets a value between a defined minimum and maximum based on a preferred value.

  6. How do you make a background image cover the entire element without repeating?

    Answer: background-size: cover; background-repeat: no-repeat;

    background-size: cover scales the image to cover the element and no-repeat prevents tiling.

  7. In flexbox, which property aligns items along the main axis?

    Answer: justify-content

    justify-content distributes items along the flex container's main axis.