Performance: Font size and scaling
This affects how quickly text appears readable and how smoothly it scales on different devices, impacting page load and visual stability.
Jump into concepts and practice - no test required
<p class="text-base md:text-lg lg:text-xl">Hello World</p><p class="text-[24px]">Hello World</p>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Fixed pixel font size | Minimal | Multiple on resize | Moderate | [X] Bad |
| Responsive relative font size | Minimal | Single or none | Low | [OK] Good |
text-xs for extra small font size.text-xs means extra small.text-9xl for very large text.text-9xl is the largest size available.<p class="text-lg">Hello</p>
text-lgtext-lg in Tailwind means large font size, bigger than base.text-lg.<p class="?">Responsive Text</p>
md: to apply styles on medium screens and up.text-sm md:text-lg means small text on mobile and large text on medium+ screens.<h1 class="?">Scaling Heading</h1>
text-sm md:text-4xl lg:text-7xl scales from text-sm (small), to text-4xl (large), to text-7xl (very large), matching the requirement.text-sm md:text-4xl lg:text-7xl [OK]