em unit
The em relative unit sets a font size
of a child element based on the size of its
parent. For example, a font equal to 2em
means that it is twice the size of its parent.
Example
Let's give the text of the <p>
element a font one and a half times
larger than the font of its parent
<div>:
<div>
text1
<p>
text2
</p>
</div>
div {
font-size: 14px;
}
p {
font-size: 1.5em;
}
:
See also
-
the
pxunit
that specifies a size in pixels -
the
frunit
that specifies a size in fr -
the
remunit
that specifies a size in rem -
the
%unit
that specifies a size in percentage -
the
vwunit
that specifies a size in vw -
the
vhunit
that specifies a size in vh -
the
vmaxunit
that specifies a size in vmax -
the
vminunit
that specifies a size in vmin