Interview Question

What is calc() function?

`calc()` computes a CSS value from an arithmetic expression.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

The `calc()` function performs arithmetic on compatible CSS values. • It can combine values with different units when the property permits them. • Operators follow CSS calculation grammar and spacing rules. • The final result must be valid for the receiving property.

💡 Simple Example

.main { width: calc(100% - 18rem); }

⚡ Quick Revision

`calc()` computes a CSS value from an arithmetic expression.