Relates to current font’s x-height. x-height is equal to lower case character ‘x’ height.
Following figure shows x-height measurement.
Example: Apply relative unit (‘ex’) to P and DIV elements.
<!DOCTYPE html>
<html>
<head>
<title> CSS ex unit </title>
<style>
p {
font-size:2ex;
}
#parent {
font-size:16px;
}
#child {
font-size:3ex;
}
</style>
</head>
<body>
<p> P element font size = (2 * x font height)</p>
<div id="parent"> Parent DIV element font size = 16px;
<div id="child"> Child DIV element font size = (3 * x font height) </div>
</div>
</body>
</html>
Result:
In the above example,