Relative Units

When we use relative units to specify a length, it depends on the size of other elements.

Let us look at some commonly used relative units:

Percentage - %

When width, height or font size of an element is specified in %, it is relative to the parent element’s width, height or font-size:

Try changing width of the div to 100% and font-size to 50%.