Skip to content

CSS Grid FR Unit Not Working Fix

DodaTech Updated 2026-06-26 2 min read

In this tutorial, you'll learn about CSS Grid FR Unit Not Working Fix. We cover key concepts, practical examples, and best practices.

The Problem

Fix CSS grid fr unit when tracks do not distribute space as expected

In this guide you will learn how to debug and fix common issues with this CSS property. Understanding why your styles are not applying as expected is critical for any web developer. By mastering these debugging techniques, you will save time and build more reliable layouts.

This CSS property is widely used in responsive web design. Understanding how to debug it saves hours of frustration when building complex layouts.

Quick Fix

Follow these step-by-step instructions to identify and resolve the issue. Each step shows a common mistake (the Wrong approach) followed by the corrected code (the Right approach) along with the expected outcome.

Step 1: Use fr for flexible tracks

/* Wrong */
.container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

/* Right */
.container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
}

Expected output: Second column is twice as wide as the others.

Step 2: Mix fr with fixed units

/* Wrong */
.container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

/* Right */
.container {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
}

Expected output: First column 200px, rest split remaining space equally.

Step 3: Understand fr distributes leftover space

/* Wrong */
.container {
    display: grid;
    grid-template-columns: 50% 1fr 1fr;
}

/* Right */
.container {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
}

Expected output: fr divides space after fixed tracks are allocated.

Prevention

Following these best practices will help you avoid grid fr unit issues in future projects:

  • Use fr for flexible, proportional grid tracks
  • Mix fr with fixed units like px for hybrid layouts
  • fr distributes remaining space after fixed tracks

Common Mistakes

Developers frequently encounter these specific pitfalls when working with grid fr unit. Being aware of them will help you spot and fix issues faster:

  1. Using fr like a percentage of total width (it distributes leftover space)
  2. Mixing fr with gap without accounting for gap consumption
  3. Expecting fr to work the same as flex-grow in flexbox

These mistakes appear frequently in real-world css code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems. By learning from these common errors, you can write cleaner code and debug more efficiently.

Practice Exercise

Put your knowledge to the test with this hands-on exercise:

Create a layout with fixed sidebar (250px) and content area using 1fr for the flexible part.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions. If you get stuck, review the steps above and use browser DevTools to inspect your work.

FAQ

### How does fr differ from percentage?

fr allocates remaining space after fixed tracks. Percentage is of total width.

Does this property work in all browsers?

Check caniuse.com for the latest browser support information.

What is the default value?

The default value depends on the property. Check the CSS specification.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro