In an xs viewport, how many columns wide is the div with class "col-sm-2 col-lg-4"?

Enhance your coding skills with our Web Development 201 Quiz. Practice with multiple-choice questions and find detailed explanations for each question. Ace your web development exam!

In a Bootstrap grid system, the layout is based on a 12-column structure by default. The class names attached to the div describe how the element should behave at various viewport sizes.

In this case, "col-sm-2" applies to small viewports and indicates that this div will occupy 2 out of the 12 columns when the viewport size is small (≥576px). Meanwhile, the "col-lg-4" class applies to large viewports and indicates that the div will occupy 4 columns when the viewport is large (≥992px).

However, for an extra small (xs) viewport, which is any size less than 576px, Bootstrap defaults to a full-width layout unless specified otherwise. Since there are no explicit columns defined for the xs breakpoint, the div will act as though it spans all 12 columns available in a row.

Therefore, in an xs viewport, the div with the classes provided will take up all 12 columns, confirming that the answer is indeed 12.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy