หากต้องการกำหนดขนาดตัวอักษรด้วยพิกเซล ให้ใช้ปุ่ม em หน่วย ด้วย ขนาดแบบอักษร ทรัพย์สิน
1em = 16px
ตัวอย่าง
คุณสามารถลองเรียกใช้รหัสต่อไปนี้เพื่อกำหนดขนาดตัวอักษรด้วย em
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
/* 30px/16 = 1.875em */
font-size: 1.875em;
}
</style>
</head>
<body>
<h1>This is demo heading</h1>
<p>This is demo text.</p>
</body>
</html>