Responsive CSS Knowledge Quiz Quiz

  1. Understanding Media Queries

    Which of the following best describes the main purpose of CSS media queries?

    1. To apply specific styles based on device characteristics such as screen size
    2. To add custom fonts to a webpage
    3. To reset browser default styles
    4. To create shadows around elements
    5. To increase the load speed of CSS files
  2. Setting Breakpoints

    In responsive design, what does a CSS breakpoint typically represent?

    1. A specific screen size where the layout changes
    2. A line of code that stops the browser from rendering
    3. A comment added to explain CSS code
    4. An error in the stylesheet
    5. A variable controlling color themes
  3. Mobile-First Design

    What is the key idea behind the mobile-first approach in CSS?

    1. Start designing for small screens, then add styles for larger screens
    2. Begin with desktop styles and remove features for smaller devices
    3. Use only pixel values for sizing elements
    4. Apply styles based on print media
    5. Avoid the use of any relative units
  4. Box Model Basics

    Which of these correctly represents the four layers of the CSS box model, from innermost to outermost?

    1. Content, Padding, Border, Margin
    2. Padding, Border, Margin, Content
    3. Border, Margin, Padding, Content
    4. Content, Margin, Border, Padding
    5. Margin, Border, Content, Padding
  5. Horizontal Centering

    What combination is used to horizontally center a block-level element with a specified width in CSS?

    1. margin-left: auto; margin-right: auto;
    2. float: left; position: fixed;
    3. display: inline-block; margin: 0;
    4. align-items: center; justify-content: flex-end;
    5. padding: 10px; text-align: right;
  6. Vertically Align Text

    Which CSS property can help vertically center text within a fixed-height container without using flexbox?

    1. line-height
    2. font-style
    3. text-indent
    4. word-spacing
    5. float
  7. Sticky Header Technique

    Which CSS value will keep a header element fixed at the top of its container as the user scrolls?

    1. position: sticky;
    2. position: absolute;
    3. position: float;
    4. visibility: visible;
    5. z-index: 100;
  8. Responsive Typography

    What is one benefit of using rem units for font sizing in responsive design?

    1. They are relative to the root element and ensure consistent scaling
    2. They prevent font smoothing issues
    3. They automatically load custom fonts
    4. They reference the screen resolution directly
    5. They are always smaller than em units
  9. Flexbox Centering

    Which combination of flexbox properties should you apply to a container to center its content both vertically and horizontally?

    1. display: flex; justify-content: center; align-items: center;
    2. display: block; text-align: center;
    3. float: right; top: 50%;
    4. display: grid; grid-gap: 0;
    5. margin: auto; width: 100%;
  10. Optimizing CSS Performance

    Which of the following is a best practice for optimizing CSS performance?

    1. Minimize the number of CSS rules and selectors
    2. Use inline styles for every element
    3. Avoid using classes and stick to element selectors only
    4. Set !important on all rules
    5. Duplicate styles across multiple stylesheets