Interview Question

What is em unit?

em is font-relative and can depend on the current element or its parent.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

The em unit is relative to a font-size reference. • For font-size, em is relative to the parent’s computed font size. • For most other properties, em uses the element’s own computed font size. • Nested em-based font sizes can multiply.

💡 Simple Example

.button { font-size: 1rem; padding: .5em 1em; }

⚡ Quick Revision

em is font-relative and can depend on the current element or its parent.