Lea Verou 6/24/2021

Inherit ancestor font-size, for fun and profit

Read Original

This CSS tutorial explains how to inherit font sizes from ancestor elements (like grandparents) rather than direct parents using type-relative units like 'em'. It covers real-world scenarios where this technique is necessary, including speech bubble components and working with <optgroup> elements in selects, providing solutions for maintaining scalable, DRY CSS code.

Inherit ancestor font-size, for fun and profit

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

1
ServiceNow and Microsoft Copilot
Marius Sandbu 1 votes
2
The Learning Loop and LLMs
Martin Fowler 1 votes