top of page

Measurements

In responsive design, you’re no longer confined to just the pixel. You can use a variety of different CSS units, functions and values to set the width and height of elements. Knowing when to use the right unit gives you control over the way elements resize as the viewport width changes. You can find these units of measure under Sizing options in the Inspector panel.

Px

The pixel is the most straightforward unit. Choosing px makes sure the element's size is always the same regardless of the screen size.


Inspector panel is open on the workspace and under measurement, pixel is highlighted.

%

The % unit is a very useful fluid unit. When setting width in %, the size is determined by a percentage of the parent container’s width. Alternatively, if the height is set to % the size is taken from the parent container’s height.


Inspector panel is open on the workspace and under measurement, percentage is highlighted.

Vw

Vw stands for viewport width. Viewport is the size of the browser in which the site is displayed. 1vw equals 1% of the viewport’s width. Setting the width of an element to 100vw will make sure it takes up the full width of the viewport.



Inspector panel is open on the workspace and under measurement, vw is highlighted.

Vh

Vh is short for viewport height. 1vh equals 1% of the viewport’s height. Setting the height of an element to 100vh ensures it always takes up the full height of the viewport.


Inspector panel is open on the workspace and under measurement, vh is highlighted.

Auto

When a property is set to Auto, its size is determined by other factors and results may vary in the context of what else is being used. For example, the height and width of a stretched image is always set to Auto, as it simply fills up the available space.


Inspector panel is open, under sizing options, Auto is highlighted.

Min & Max

While using fluid units of measure you can add a minimum or maximum to the width and, or height of an element. For instance if you set an element’s width to 50% it will remain half the size of its parent. You can then set a min width of 400px, so the element never gets smaller than that.


Inspector panel is open and under sizing options, min W is highlighted.

None

If a property is set to None, it means there is no value set for it. None can only be applied to min and max properties.


Inspector panel is open and under sizing options, None is shown under Min H.

Fr

Fr is a fractional unit used for sizing columns and rows in a grid. 1fr represents 1 fraction of the available space. Sizing with fr is only available in Edit Grid mode.


On the canvas, there is a dropdown menu shown and fraction is highlighted.

EXPLORE MORE TUTORIALS

Grid

TUTORIAL

Grid

Sizing

TUTORIAL

Sizing

Building a proportionally scaling design

TUTORIAL

Building a proportionally scaling design

Was this lesson helpful?

Thank you for your feedback!

How can we improve?

Thanks for submitting!

Explore more topics

Additional resources

Visit our help center

Ask the community

Hire an expert

Contact customer care

bottom of page