Western Governors University (WGU) ITSW2120 D276 Practice Exam

Session length

1 / 20

Which two units make the size of an element responsive to screen size?

em

ex

vw

The correct choice is based on understanding how responsive design works in web development, specifically with the use of viewport units. The units vw (viewport width) and vh (viewport height) are inherently responsive because they are based on the size of the viewport (the visible area of the browser window).

Using vw, for instance, allows an element's size to adapt dynamically as the viewport size changes. If you set an element's width to 50vw, it takes up 50% of the viewport width, which means if the user resizes the browser window, the element will resize accordingly. This flexibility is essential for creating fluid layouts that work well across different devices, such as desktops, tablets, and smartphones.

While em and ex units are also used for sizing elements, they are relative to the font size of the parent element or the 'x-height' of the font, which does not directly correlate with the overall screen size. This makes them less adaptable in creating truly responsive layouts compared to the viewport units that directly react to changes in the screen size.

In summary, viewport width and height units are specifically designed to adjust based on the user's screen dimensions, which is why they are the correct choice for making element sizes responsive to screen size.

vh

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy