Number 2 of this exercise says “the height and width of a content area can be set in pixels or percentage”. What is the difference between these two units and how do I know which unit to use?
A pixel is an absolute unit of measure equal to 1/96 of an inch. On the other hand, percentage is a relative unit of measure and is depended on the specific property in question. For example, the
height properties define percentages relative to the
height of a parent element whereas the
font-size property defines percentages relative to the
font-size of a parent element.
Both units have their uses but one major advantage of percentages is that this unit lends itself more naturally to responsive design.