🎨 HTML / CSS
Intermediate
What is CSS Grid's fr unit?
Answer
The fr (fractional unit) is a CSS Grid-specific unit that represents a fraction of the available free space in the grid container. After fixed sizes and min-content requirements are satisfied, remaining space is distributed proportionally using fr units. grid-template-columns: 1fr 1fr 1fr creates three equal columns. grid-template-columns: 2fr 1fr creates two columns where the first is twice the width of the second. repeat(3, 1fr) is a convenient shorthand. The fr unit differs from percentages because it accounts for gap spacing — 1fr fills available space after gaps, while 33.33% does not account for gaps and can cause overflow.
Previous
What are web fonts and how do you use @font-face?
Next
What is the CSS object-fit property?
More HTML / CSS Questions
View all →- Intermediate How does the CSS cascade work?
- Intermediate What is BEM (Block Element Modifier) methodology in CSS?
- Intermediate What are CSS custom properties (CSS variables)?
- Intermediate What is the difference between em, rem, px, vh, and vw units in CSS?
- Intermediate How does Flexbox differ from CSS Grid? When would you use each?