What Is Fr in Webflow?

Webflow is a powerful web design tool that allows you to build responsive websites without writing code. It provides a visual interface for designing and developing websites, making it accessible to designers and developers alike. One of the key features of Webflow is the ability to use CSS units like pixels (px), percentages (%), viewport height (vh), and viewport width (vw) to control the layout and styling of elements on a web page.

What is “fr” in Webflow?

One CSS unit that you may come across in Webflow is the “fr” unit. The “fr” unit stands for “fractional unit” and is used in CSS Grid layouts to create flexible and responsive designs. It allows you to define the size of columns or rows based on a fraction of available space.

Using “fr” in CSS Grid

CSS Grid is a powerful layout system that allows you to create complex grid-based layouts with ease. To understand how “fr” works, let’s consider an example where we have a grid container with three columns:

<div class="grid-container">
  <div class="item">Column 1</div>
  <div class="item">Column 2</div>
  <div class="item">Column 3</div>
</div>

In this example, we want the first column to take up twice as much space as the second column, and the third column to take up three times as much space as the second column.

To achieve this using “fr”, we can set the grid-template-columns property on the grid container:

.grid-container {
  display: grid;
  grid-template-columns: 2fr 1fr 3fr;
}

Here, we are using the “fr” unit to define the size of each column. The first column will take up two-thirds of the available space, the second column will take up one-third of the available space, and the third column will take up three-thirds (i.e., the entire available space).

Benefits of using “fr”

The “fr” unit provides several benefits when working with CSS Grid layouts:

  • Flexible and responsive: By using “fr”, you can create fluid layouts that adjust to different screen sizes. The columns or rows defined with “fr” units automatically adapt to the available space.
  • Easy to maintain: Since “fr” units are based on fractions, it becomes easier to maintain consistent proportions between columns or rows.
  • Readable and intuitive: The use of “fr” units makes your code more readable and intuitive as it clearly defines the relative sizes of columns or rows.

In conclusion, the “fr” unit in Webflow is a powerful tool for creating flexible and responsive CSS Grid layouts. It allows you to define the size of columns or rows based on fractions of available space, resulting in visually engaging and dynamic web designs.