Bootstrap Grid System Responsive Layouts Quiz Quiz

Explore key concepts of responsive web design with this focused quiz on the Bootstrap grid system, covering columns, breakpoints, offsets, ordering, and fluid containers. Assess your understanding of how to use classes for building flexible and visually balanced layouts that adapt to various device sizes.

  1. Understanding Column Specifications

    Which class should be used to create a column that spans 4 out of 12 grid columns on medium devices and above, but spans the full width on extra small devices?

    1. col-md-4 col-12
    2. col-4 col-md-12
    3. col-12 col-md-4
    4. col-xs-4 col-md-12

    Explanation: The correct answer is col-12 col-md-4, which means the column takes all 12 columns (full width) on smaller screens and 4 columns on medium and larger screens. The option col-xs-4 col-md-12 uses an outdated class and reverses the intended sizes. Col-4 col-md-12 mistakenly defines 4 columns on all sizes and 12 on medium and above, which is the opposite of the requirement. Col-md-4 col-12 is not the standard ordering and may not yield predictable results.

  2. Breakpoint Class Usage

    In a responsive layout, which class ensures a column is only visible and occupies space on large screens and remains hidden on small and medium screens?

    1. col-lg-visible
    2. col-lg-only
    3. d-none d-lg-block
    4. visible-lg

    Explanation: d-none d-lg-block hides the element by default and displays it as a block element only on large screens and above. The option col-lg-only is not a valid class within this system. Col-lg-visible and visible-lg are not standard or recognized classes for controlling visibility based on breakpoints. Using the correct combination of visibility classes is necessary for responsive behavior.

  3. Working with Offsets

    Suppose you want to move a column to the right by 2 grid spaces on medium devices; which class would you use for this purpose?

    1. col-md-offset-2
    2. offset-md-2
    3. md-offset-2
    4. col-offset-md-2

    Explanation: offset-md-2 properly applies a margin on the left to shift the column by 2 grid columns on medium screens and up. Col-md-offset-2 is an older version and may not be supported. The classes col-offset-md-2 and md-offset-2 do not exist and won't achieve the intended effect. Using the exact offset class for the right breakpoint is essential for layout spacing.

  4. Column Ordering Flexibility

    If you want to reverse the order of two columns on small devices but keep their natural order on medium and larger screens, which set of classes should you use?

    1. col-reverse-sm and col-normal-md
    2. order-md-normal and order-sm-reverse
    3. order-2 order-md-1 and order-1 order-md-2
    4. reverse-order-xs and normal-order-md

    Explanation: The correct approach is order-2 order-md-1 on the first column and order-1 order-md-2 on the second column, swapping their positions on small screens while restoring original order on larger screens. The other options use incorrect or nonexistent class names, such as col-reverse-sm, reverse-order-xs, or order-md-normal, and will not affect the columns’ order as required. Using the provided ordering classes is the preferred, standardized method.

  5. Fluid Versus Fixed Containers

    Which class enables a layout container to always span the full width of the viewport across all device sizes, thus making layouts more fluid?

    1. container-100
    2. container-fixed
    3. container-fluid
    4. container-responsive

    Explanation: container-fluid creates a container that is always 100% wide to the viewport, making the content stretch or shrink for any screen size. Container-fixed is not a standard class and does not exist. Container-responsive is not an actual class in this system, and container-100 is similarly incorrect. The fluid class is essential for truly adaptable layouts.