Fact-checked by Grok 2 weeks ago

CSS grid layout

CSS Grid Layout is a two-dimensional layout system in CSS that enables the creation of complex page structures by dividing available space into rows and columns, allowing precise control over the size, position, and layering of elements. Developed as part of the CSS Grid Layout Module Level 1, it optimizes by positioning the children of a grid container into arbitrary slots within a flexible or fixed-size grid. Unlike earlier CSS layout methods such as floats or the single-axis-oriented Flexbox, Grid Layout supports alignment and distribution of content in both dimensions simultaneously, making it ideal for responsive designs that adapt across devices without altering markup. It emerged in response to the evolution of pages from simple documents to interactive applications, where traditional techniques like floats proved inadequate for sophisticated, adaptive layouts. Key properties include display: grid to establish a grid container, grid-template-columns and grid-template-rows to define track sizes (e.g., using fr units for fractional distribution or minmax() for flexible sizing), and placement properties like grid-column and grid-row to position items explicitly or via named areas. Additional features such as gap for spacing between tracks and grid-auto-flow for automatic item placement enhance its versatility for both major page regions and fine-grained elements. CSS Grid offers advantages over table-based layouts by supporting overlapping elements, layering, and more complex arrangements that are easier to implement and maintain. As of November 2025, it enjoys broad browser support, with full compatibility in 57+, 52+, 10.1+, 16+, and 44+, covering approximately 94.91% of global usage. While partial support exists in older versions like 10-11, modern development typically relies on its stable, unprefixed implementation across major browsers.

Overview and Motivation

Introduction to CSS Grid

CSS Grid Layout is a module of the Cascading Style Sheets (CSS) specification that enables the creation of complex, responsive two-dimensional layouts by arranging elements into rows and columns on an underlying grid structure. This layout system allows web developers to precisely control the size, position, and layering of user interface elements, making it particularly suited for dividing web pages into major regions such as headers, sidebars, and content areas. The core purpose of CSS Grid is to provide a flexible framework for defining spatial relationships between elements in both dimensions simultaneously, overcoming the constraints of earlier CSS layout techniques that operated primarily in one dimension. Introduced in response to the limitations of methods like CSS floats and Flexbox—which excel at linear arrangements but struggle with intricate grid-based designs—CSS Grid was formalized as a public working draft by the in April 2011. While CSS Grid assumes familiarity with basic CSS concepts such as selectors and the box model, it requires no prior experience with advanced layout systems, enabling designers and developers to build sophisticated page structures with relative ease. In contrast to one-dimensional tools like Flexbox, which are ideal for component-level alignment, facilitates holistic page composition.

Advantages over Other Layout Methods

CSS Grid Layout provides two-dimensional control, enabling developers to define and manage both rows and columns simultaneously within a single container. This contrasts with Flexbox, which operates primarily in one dimension—either horizontally or vertically—requiring nested containers to approximate a full grid structure. As a result, Grid simplifies the creation of balanced, tabular-like arrangements without the fragmentation issues common in float-based layouts or the semantic misuse of tables for non-tabular data. One key responsive capability of CSS Grid lies in its native support for flexible track sizing using units like fr and functions such as minmax(), which allow layouts to adapt fluidly to viewport changes without relying on media queries for fundamental adjustments. This built-in responsiveness outperforms traditional float methods, which often demand extensive clearfix hacks and media query overrides to achieve similar fluidity, and surpasses table layouts by avoiding rigid, non-scalable structures. For complex layouts, Grid facilitates precise item placement via named areas or line-based positioning, eliminating the need for convoluted HTML markup or positioning tricks that complicate maintenance in float- or absolute-positioned designs. In terms of accessibility and semantics, CSS Grid enhances navigation by preserving the document's source order by default, allowing content to flow logically for assistive technologies without the disruptions caused by floats, which collapse and reorder elements unpredictably, or absolute positioning, which removes items from the normal flow entirely. This approach supports the definition of semantic regions—such as headers, sidebars, and main content—directly in CSS, improving the overall structure for users relying on keyboard or traversal, unlike older methods that often flatten or obscure logical hierarchies. Performance-wise, CSS Grid benefits from hardware-accelerated rendering in modern browsers, particularly for animations involving grid items, where properties like transforms leverage GPU processing to achieve smoother results compared to the reflow-heavy computations in float alternatives.

Core Concepts

Terminology and Basic Structure

CSS Grid Layout establishes a two-dimensional layout system in CSS, where an element is designated as a grid container to organize its direct children, known as grid items, into rows and columns. The foundational setup involves applying the display: grid or display: inline-grid property to a parent element, which creates a block-level or inline-level grid formatting context, respectively. For instance, a basic structure might consist of a container div enclosing several child divs, as shown below:
html
<div class="grid-container">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</div>
With the corresponding CSS:
css
.grid-container {
  display: grid;
}
This configuration positions the child divs as grid items within the emerging grid structure. Central to this system are several key terms that define its components. A grid container is the element to which display: grid or display: inline-grid is applied, establishing the grid and managing the layout of its contents. Grid items are the direct, in-flow children of the grid container, which participate in the grid layout; non-replaced inline elements, table parts, and other specific elements may be treated differently. Grid lines are the horizontal and vertical dividers that form the boundaries of the grid, numbered starting from 1 at the edges and optionally named for referencing during placement. Grid tracks refer to the spaces between two adjacent grid lines, manifesting as rows or columns that hold the grid items. Finally, grid areas are rectangular regions composed of one or more adjacent grid cells, spanning multiple tracks and often named to facilitate item placement across them. The grid origin serves as the reference point for positioning, defined as the intersection of the first row grid line (line 1) and the first column grid line (line 1), aligned according to the document's writing mode—typically the top-left in left-to-right languages. Conceptually, a CSS can be visualized as a of intersecting lines forming a of cells, where each cell is bounded by grid lines and occupies the space of one row and one column ; multiple cells may combine into larger grid areas that span several tracks, allowing items to occupy irregular or named regions within this structure.

Explicit vs Implicit Grids

In CSS Grid Layout, the explicit grid refers to the predefined structure of rows and columns established by the author using the grid-template-rows and grid-template-columns properties on the grid container. These properties specify the exact number and sizes of tracks, creating a fixed layout framework where grid items are intended to be placed within the defined bounds. For instance, setting grid-template-columns: 200px 1fr; defines two explicit columns, the first with a fixed width of 200 pixels and the second taking the remaining available space. This explicit definition ensures predictable positioning and sizing for items that fit within it, forming the core of the grid's intentional design. In contrast, the implicit grid is automatically generated by the when grid items are placed outside the bounds of the explicit grid, such as through auto-placement or explicit positioning that exceeds the defined tracks. This extension occurs dynamically to accommodate overflowing content, with the size and behavior of these additional tracks controlled by the grid-auto-rows and grid-auto-columns properties. By default, implicit tracks are sized to auto, which resolves to the content-based size of the largest item in that track, but authors can override this with fixed values like 100px or flexible units. The key difference lies in authorship: explicit grids are rigidly author-defined for structure, while implicit grids adapt responsively to content needs, potentially leading to variable layouts if not controlled. The placement of items into these grids, particularly in the implicit portion, is governed by the grid-auto-flow property, which dictates the direction and packing strategy for auto-placed items. The default value is row, where items fill each row sequentially from left to right before moving to a new row, adding implicit rows as needed if the explicit grid is exhausted. Alternatively, column fills columns top-to-bottom before adding new columns, which can be useful for vertical-first layouts. Adding the dense keyword to either direction (e.g., grid-auto-flow: row dense;) enables the algorithm to backfill gaps left by larger items with subsequent smaller ones, optimizing space usage but potentially altering the visual order of items. A practical implication of implicit grid creation arises when items overflow the explicit tracks, causing the grid to expand and potentially affecting overall sizing. For example, consider a grid container with display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 50px; grid-auto-flow: row;, which defines two explicit columns but no explicit rows. Placing six grid items without specific positions would fill the two explicit columns in the first implicit row (sized to 50px) with two items, then automatically create a second implicit row of the same height to hold the next two items, and a third row for the remaining two items, ensuring all content is accommodated without . This expansion can influence the container's height if rows are fixed-sized, but using auto for implicit rows might lead to taller tracks based on content, highlighting the need for careful property selection to maintain design intent.

Grid Container Properties

Defining Grid Tracks

In CSS Grid Layout, grid tracks are the rows and columns that form the grid's structure, defined explicitly on the grid container using the grid-template-columns and grid-template-rows properties. These properties accept a space-separated list of track sizes, which can be fixed values such as lengths (e.g., px, em) or percentages, or flexible values using the fr unit to distribute available space proportionally among tracks. For instance, grid-template-columns: 100px 1fr 2fr; creates three columns: a fixed 100-pixel width for the first, and the remaining space divided such that the second column receives one-third and the third receives two-thirds of the flexible portion. The grid-template property serves as a shorthand, allowing both row and column definitions in a single declaration, such as grid-template: 1fr auto / 200px 1fr;, which sets one flexible row and one auto-sized row separated by a slash from two columns. Spacing between tracks is controlled by the gap properties, which insert fixed-size gutters treated as additional tracks in the layout algorithm. The row-gap property specifies the gap between rows, column-gap between columns, and the gap shorthand combines both (e.g., gap: 10px 20px; for uniform row gaps of 10 pixels and column gaps of 20 pixels). These replace the deprecated grid-row-gap, grid-column-gap, and grid-gap names, with the initial value for all being 0. When the number of grid items exceeds the explicit tracks defined by grid-template-columns or grid-template-rows, or when items are explicitly placed beyond those tracks, the layout triggers the creation of an implicit grid. Implicit tracks are automatically generated and sized according to the grid-auto-rows and grid-auto-columns properties (defaulting to auto, which typically resolves to the minimum content size of placed items). The following example demonstrates a three-column grid with mixed fixed and flexible track sizes, including gaps:
css
.grid-container {
  display: grid;
  grid-template-columns: 100px 1fr 200px;
  gap: 10px;
}
This configuration produces a grid where the first column is 100 pixels wide, the second expands to fill the remaining space minus gaps and the third column, and the third is fixed at 200 pixels, with 10-pixel gaps between all tracks.

Grid Template Areas

The grid-template-areas property allows authors to define named grid areas within a CSS grid container using a series of quoted strings, where each string represents a row and space-separated identifiers denote column-spanning areas. This syntax creates an explicit grid structure visually, akin to an ASCII art diagram, by assigning names to rectangular regions that span one or more cells. For instance, a declaration like grid-template-areas: "header header" "sidebar main"; defines a two-row, two-column grid where "header" spans the full first row and "sidebar" and "main" occupy the second row's cells. The number of strings determines the explicit grid's row count, while the maximum number of space-separated tokens across all strings sets the column count; these must align precisely with any accompanying grid-template-rows and grid-template-columns declarations to avoid invalidation. Unnamed cells can be marked with a period (.) to indicate empty space, but the overall layout must form a complete, rectangular without gaps or disconnected regions. Invalid configurations, such as overlapping named areas (e.g., assigning the same name to non-adjacent or irregularly shaped cells) or rows with unequal token counts, render the property invalid, falling back to an implicit . Each named area automatically generates corresponding named grid lines (e.g., "header-start" and "header-end") for precise placement. This approach enhances readability, particularly for complex layouts like dashboards or multi-section webpages, by providing a declarative, at-a-glance of the grid structure directly in the . It promotes maintainability, as changes to the layout—such as reconfiguring areas for responsive design—can be made without altering or relying on numerical line references. Consider a webpage with 12 distinct areas, such as a header spanning full width, a navigation bar, a sidebar, a main content area divided into hero, articles, and ads, and a footer with sections; the following CSS defines it using grid-template-areas alongside track sizing:
css
.grid-container {
  display: grid;
  grid-template-columns: 200px 1fr 150px; /* Sidebar, main, ad sidebar */
  grid-template-rows: auto 60px auto 1fr auto 100px; /* Header, nav, hero, articles, ad, footer */
  grid-template-areas:
    "header header header"
    "nav nav nav"
    "sidebar hero ad"
    "sidebar articles ad"
    "sidebar articles ad"
    "footer footer footer";
}
This creates a six-row, three-column explicit grid where areas like "articles" span two rows vertically and align seamlessly with the defined tracks, offering a clear blueprint for a responsive page structure. The rendered layout would position elements accordingly: a full-width header at the top, followed by navigation, then a hero section beside the sidebar and ad, with articles filling the central space below, and a footer at the bottom— all without numerical positioning in the container declaration.

Grid Item Properties

Placing Items with Lines

In CSS Grid Layout, grid items can be precisely positioned using grid lines, which are the horizontal and vertical boundaries that define the grid's tracks. These lines are numbered starting from 1 in the inline (column) and block (row) directions, respectively, allowing items to be placed by specifying their starting and ending lines. This line-based placement enables explicit control over an item's position and span, overriding the default auto-placement algorithm. The primary properties for line-based placement are grid-column-start and grid-column-end for columns, and grid-row-start and grid-row-end for rows. The grid-column-start property sets the grid line where the item's left edge aligns, using a positive integer for forward numbering or a negative integer to count from the opposite end (e.g., -1 for the last line). Similarly, grid-column-end defines the right edge. For rows, grid-row-start and grid-row-end function analogously in the block direction. If unspecified, these default to auto, which defers to auto-placement, but explicit values ensure deterministic positioning. Shorthand properties simplify declarations: grid-column combines grid-column-start and grid-column-end with a slash separator (e.g., grid-column: 1 / 3;), placing the item from column line 1 to line 3. Likewise, grid-row: 2 / 4; spans from row line 2 to 4. The grid-area shorthand encompasses all four properties in the order row-start, column-start, row-end, column-end (e.g., grid-area: 1 / 2 / 5 / 4;), or can reference named areas directly (e.g., grid-area: header;) if defined via grid-template-areas. Named lines, declared in grid-template-columns or grid-template-rows (e.g., [start] 1fr [main] 2fr [end]), allow symbolic placement like grid-column: start / main;. To span multiple tracks without specifying an exact end line, the [span](/page/Span) keyword is used in the end position (e.g., grid-column: 1 / span 2;), which extends the item across two column tracks from line 1. This relative spanning is particularly useful for responsive designs where track counts vary, and it can combine with named lines (e.g., grid-row: main / span 3;). Spans cannot be negative, and if the start and end resolve to the same line, the item receives zero-sized placement unless auto-placement intervenes. Overlaps occur if multiple items claim the same area, with later items in document order painting over earlier ones. For instance, consider a 4x4 explicit grid defined by grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);, which creates 4 column lines and 4 row lines. To position five items explicitly and avoid auto-placement:
css
.item1 { grid-area: 1 / 1 / 2 / 3; } /* Spans row 1, columns 1-2 */
.item2 { grid-area: 2 / 1 / 4 / 2; } /* Spans rows 2-3, column 1 */
.item3 { grid-column: 2 / span 2; grid-row: 2; } /* Row 2, columns 2-3 */
.item4 { grid-row: 3 / span 2; grid-column: 3; } /* Column 3, rows 3-4 (implicit row 4) */
.item5 { grid-area: 4 / 2 / 5 / 4; } /* Row 4, columns 2-3; overlaps item4 */
This arrangement fills the grid with a controlled overlap between items 4 and 5, demonstrating how line placement can create complex layouts, including the expansion of an implicit when items are positioned beyond the explicit tracks.

Sizing and Alignment

In CSS Grid Layout, the alignment of grid items within their respective grid areas is controlled by properties that position items along the inline () and (vertical) axes. The justify-items property sets the default alignment for all grid items along the inline axis, with possible values including start (aligns to the start edge), end (aligns to the end edge), center (centers the item), and stretch (the default, which expands the item to fill the grid area if possible). Similarly, align-items applies the same alignment values along the axis, providing a uniform default behavior across the grid container. These properties ensure consistent positioning without affecting the overall track sizes. For overriding the default alignment on individual grid items, the justify-self and align-self properties allow per-item control along the inline and block axes, respectively, using the same value set as their container counterparts. The place-items shorthand combines align-items and justify-items into a single declaration, such as place-items: center;, which centers all items along both axes, simplifying common alignment patterns. When the grid tracks do not fully occupy the grid container—due to fixed or intrinsic sizing—extra space can be distributed using container-level properties. The justify-content property aligns the entire grid along the inline axis within the container, with values like start, end, center, space-between, space-around, and space-evenly to handle surplus space. Likewise, align-content performs the same distribution along the block axis. These properties operate on the grid as a whole, complementing item-level alignment by adjusting track positioning after items are placed. In implicit grids, where tracks are automatically generated to accommodate items placed outside the explicit grid, auto-sizing interacts with content through properties like grid-auto-rows and grid-auto-columns, which default to auto. This auto value sizes tracks based on the content's intrinsic dimensions, such as the maximum min-content or preferred width/height of items in the track, while alignment properties like justify-self or align-self determine how items fit within those tracks—stretching to fill by default or aligning to edges if space remains. For instance, if an item with substantial content is placed in an implicit row, the row expands to fit the content's block size, but align-self: start would position the item at the top of that expanded area rather than stretching it vertically. A practical example demonstrates centering items within cells while evenly distributing tracks. Consider a grid container with display: grid; place-items: center; justify-content: space-evenly; align-content: center; grid-template-columns: repeat(3, 1fr);. This centers each item horizontally and vertically in its cell (place-items: center) and evenly spaces the columns within the container if extra horizontal space exists (justify-content: space-evenly), achieving balanced layout without manual track adjustments.

Special Units and Functions

The fr Unit

The fr unit, short for "fraction," is a flexible sizing unit in CSS Grid Layout that represents a fraction of the available space in the grid container after accounting for tracks with fixed sizes and gaps. It allows grid tracks to proportionally distribute the remaining "leftover" space, making it particularly useful for creating responsive layouts that adapt to the container's dimensions. As defined in the CSS Grid Layout specification, the fr unit functions as a flex factor, where the size of an fr-sized track is calculated as its flex factor multiplied by the leftover space, divided by the sum of all flex factors across flexible tracks. The calculation of fr units occurs during the grid sizing algorithm's "expand flexible tracks" phase, after non-flexible tracks (such as those sized with absolute lengths like pixels or percentages) and gutter sizes have been subtracted from the container's total size to determine the leftover . For instance, in a 300px-wide container with no gaps and track sizes defined as 2fr 1fr, the total flex factors sum to 3; thus, the first track receives (2/3) × 300px = 200px, and the second receives (1/3) × 300px = 100px. If the sum of flex factors is less than 1, the tracks take only that fractional portion of the leftover , leaving the rest unused. In cases of infinite available (e.g., when the container's size is undefined or auto), fr tracks are initially sized to their max-content contribution, and a hypothetical "1fr" size is derived by dividing each track's max-content size by its flex factor, using the maximum such value as the basis for proportional distribution. fr units can be combined with fixed units like pixels ([px](/page/PX)) or percentages (%) in track definitions, where fixed sizes are resolved first, and the remaining space is then fractionated among fr tracks—for example, grid-template-columns: 1fr 100px allocates the leftover space (after subtracting 100px) entirely to the first track. In contexts involving content-based sizing keywords like min-content or max-content, fr units behave flexibly but are constrained by item content: under min-content sizing for the container, fr tracks may shrink to their items' minimum content sizes if those exceed the proportional share, effectively treating the fr as a minimum of auto; conversely, in max-content contexts, fr tracks expand based on items' maximum content but still distribute any additional space proportionally. A standalone fr track implicitly behaves as minmax(auto, 1fr), ensuring it never shrinks below its content's needs. The fr unit's reliance on available space makes it inherently responsive, allowing layouts to scale fluidly with or container resizes without requiring —for example, tracks defined as 1fr 3fr will maintain a 1:3 ratio as the container width changes from 400px (yielding 100px and 300px) to 800px (200px and 600px). This proportional behavior is ideal for designs like a sidebar-main , where the following CSS creates a two-column :
css
.grid-container {
  [display](/page/Display): grid;
  grid-template-columns: 1fr 3fr;
  [gap](/page/Gap): 1rem;
  height: 100vh;
}
Here, the sidebar (first track) occupies one-fourth of the container's width, while the main content (second track) takes three-fourths, with both adjusting dynamically as the viewport resizes, ensuring the layout remains balanced across devices.

minmax() and repeat()

The minmax() function in CSS Grid allows to define a size range for grid tracks, specifying a minimum and maximum value that the track can take. This enables tracks to be flexible while enforcing boundaries, such as ensuring a column is at least 100px wide but can expand up to a fraction of the available space. The syntax is minmax(min, max), where both min and max are valid <length-percentage>, <flex> (like fr units), or keywords such as auto, min-content, or max-content; if max is less than min, it is treated as equal to min. It is primarily used within properties like grid-template-columns or grid-template-rows to create responsive layouts without relying solely on fixed sizes. For instance, the declaration grid-template-columns: minmax(200px, 1fr) minmax(100px, 2fr); creates two columns: the first grows from a minimum of 200px to fill available space proportionally, while the second starts at 100px and can expand twice as much as the first. This is particularly useful for content-driven designs, where tracks adapt to intrinsic sizes like min-content (the smallest unbreakable content width) but cap at a flexible maximum to prevent over-expansion. As defined in the CSS Grid Layout Module Level 1, minmax() integrates with the grid's track sizing algorithm, resolving to the minimum during content-based sizing phases and the maximum during distribution of free space. The repeat() notation complements minmax() by allowing a pattern of track sizes to be repeated multiple times, simplifying the definition of grids with recurring structures. It takes the form repeat(<positive-integer> | auto-fill | auto-fit, <track-list>), where the first argument specifies the number of repetitions and the second is a space-separated list of track sizes, line names, or other functions like minmax(). Fixed repetitions use a positive integer (e.g., repeat(3, 1fr) for three equal flexible columns), while auto-fill and auto-fit create as many tracks as fit the container, collapsing empty tracks in the case of auto-fit. This notation is applied in grid-template-columns and grid-template-rows to avoid verbose listings, especially for large or patterned grids. A common example is grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));, which generates a responsive grid of columns that are at least 250px wide, automatically adding or removing columns based on the container's width to fill space without overflow. Here, repeat() with auto-fill ensures tracks do not grow beyond their maximum if space remains, promoting efficient use of viewport dimensions. According to the CSS Grid Layout Module Level 1 specification, repeat() expands inline during parsing, inserting the track list the specified number of times while preserving any named lines. Combining minmax() and repeat() enhances grid flexibility, as seen in layouts like grid-template-columns: 1fr repeat(auto-fit, minmax(150px, 1fr)) 1fr;, which bookends a variable number of content columns with fixed side gutters. This approach, supported since the initial release of CSS Grid in browsers around 2017, allows for adaptive designs that respond to content and screen sizes without media queries. Both functions are baseline features of the CSS Grid specification, ensuring broad interoperability across modern rendering engines.

Advanced Features

Subgrid

Subgrid is a feature introduced in CSS Grid Layout Module Level 2 that allows a grid item to participate in its parent grid's track sizing and alignment, effectively inheriting the parent's grid lines and track sizes without redefining them. By setting grid-template-columns or grid-template-rows to the subgrid keyword on a grid item, that item becomes a subgrid, aligning its content to the parent's defined tracks. This enables seamless nested layouts where child elements snap to the parent's grid structure, reducing the need for manual calculations or additional wrappers. The syntax for subgrid is straightforward: in a grid container's child that is itself a grid, apply grid-template-columns: subgrid; to use the parent's column tracks, or grid-template-rows: subgrid; for rows, or both for a full subgrid. Specific tracks can be selected using the span keyword or line names, but subgrids do not support explicit track sizes or the repeat() function within their templates—only the parent's tracks are referenced. Subgrids inherit the gap properties from the parent grid, which can be overridden with explicit gap values on the subgrid. Common use cases for subgrid include building modular component libraries where nested components must align precisely with a parent layout, such as form elements spanning across a dashboard grid, or creating complex tables with sub-rows that inherit column widths for consistent alignment. It is particularly useful for aligning nested navigation menus or card layouts within a larger grid-based page structure, ensuring visual harmony without duplicating track definitions. Browser support for subgrid has stabilized in major engines since 2019-2023: Chrome and Edge (based on Chromium) implemented it in version 117, Firefox in version 71, and Safari in version 16.0+. As of November 2025, it enjoys over 95% global coverage, making it viable for production use with minimal fallbacks. For example, consider a parent grid defining a navigation layout with three equal columns:
css
.parent {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1rem;
}
Without subgrid, a nested menu in the second column might require redefining tracks, leading to misalignment:
css
.nested-menu {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Misaligned with parent */
}
With subgrid, the nested menu inherits the parent's tracks starting from the second line:
css
.nested-menu {
  display: grid;
  grid-column: 2; /* Positions in parent's second column */
  grid-template-columns: subgrid; /* Inherits parent's column tracks */
}
This ensures the nested items align perfectly with the parent's grid lines, as if they were direct children, improving .

Nested Grids and Best Practices

Nested grids in CSS Grid Layout are created by applying display: grid to a grid item within a parent grid container, allowing hierarchical layouts where child elements form their own independent grid structure. This approach enables complex, modular designs, such as cards or sections within a larger , but the nested grid operates autonomously, defining its own tracks and areas separate from the parent. For instance, a parent grid with three equal columns will not automatically constrain a nested grid inside one of those columns to match the parent's sizing unless explicitly configured. Without the subgrid feature, alignment between parent and nested grids presents significant challenges, as the child grid's tracks do not inherit the parent's dimensions or positions, often leading to misaligned content across levels. Developers must manually replicate track sizes (e.g., using identical grid-template-columns values) to achieve visual harmony, which can introduce maintenance issues in dynamic layouts. This independence promotes flexibility but requires careful planning to prevent disjointed appearances. Best practices for nested grids emphasize to ensure structural integrity and accessibility; for example, wrapping grid items in elements like <section> or <article> maintains logical document flow for screen readers, even as visual positioning changes. Avoid over-nesting grids, as excessive levels (e.g., more than two or three deep) can degrade performance by increasing the browser's layout computation overhead, particularly in where nested grids with percentage heights have shown exponential slowdowns. Instead, combine CSS Grid for two-dimensional layouts with Flexbox for one-dimensional sub-elements, such as aligning buttons or within a grid card, to simplify code and improve responsiveness—test across devices using to verify adaptive behavior. Common pitfalls include overlapping elements due to implicit track sizing, where unplaced or spanning items create unintended auto-generated rows or columns sized to auto (often collapsing to minimal height without content), causing content to bleed into adjacent areas. For example, a nested grid item using grid-row: span 3 beyond explicit tracks may trigger an implicit track that overlaps siblings if not bounded by grid-auto-rows: minmax(0, [auto](/page/Auto)). Accessibility issues arise from non-logical visual ordering, where grid placement reorders items out of DOM sequence, confusing screen readers that follow source order; mitigate this by preserving tab and reading flows with landmarks or avoiding drastic rearrangements. For optimization, leverage container queries—standardized in —to create modular nested grids that respond to their immediate container's size rather than the , enabling reusable components like responsive grids within dashboards. Declare a container with container-type: inline-size on the parent, then use @container queries (e.g., @container (min-width: 300px) { .nested-grid { grid-template-columns: repeat(2, 1fr); } }) to adapt inner layouts, reducing reliance on global and improving performance in nested scenarios by localizing style rules. A practical example is a featuring a main for overall (header, sidebar, area) with nested grids for card-based sections in the area. The outer grid uses display: [grid](/page/Grid); grid-template-areas: "header header" "sidebar main" "footer footer"; grid-template-rows: auto 1fr auto;, while a .cards item inside .main applies display: [grid](/page/The_Grid); grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); [gap](/page/Gap): 1rem;, nesting further grids in each card for internal rows like title and details. To optimize performance, limit nesting depth, use [gap](/page/Gap) over margins for spacing, and apply container queries to the .cards container for breakpoint-specific column adjustments, ensuring efficient rendering without excessive reflows.

History

Specification Development

The development of the CSS Grid Layout specification originated from a proposal submitted by the Internet Explorer team in 2011, aiming to introduce a robust two-dimensional layout system inspired by grid-based approaches in , which enable precise positioning and sizing of elements akin to traditional page composition. This initiative addressed longstanding limitations in web layout tools, drawing on concepts like adaptive grids for responsive document structures. The first Working Draft of the CSS Grid Layout Module Level 1 was published by the W3C CSS on 7 April 2011, marking the formal start of the standardization process. Key contributors to the specification included Rossen Atanassov from , who led early efforts based on the IE implementation; Tab Atkins Jr. from , focusing on algorithmic and sizing details; and Elika J. Etemad (known as fantasai) from Fantasy Interactive (later ), who refined syntax and integration aspects. Their collaborative editing shaped the module through iterative feedback from the CSS . The specification progressed through multiple Working Drafts, incorporating refinements to grid definition, item placement, and alignment behaviors, before advancing to Candidate Recommendation status on 29 September 2016. It has remained in Candidate Recommendation status since, with the latest draft published on 26 March 2025, and is widely implemented as stable for production use despite not yet achieving full W3C Recommendation. Subsequent iterations addressed advanced nesting capabilities in the CSS Grid Layout Module Level 2, first published as a Working Draft on 6 February 2018, which introduced the subgrid feature to allow child grids to align and size relative to their parent grid's tracks. This level reached Candidate Recommendation status on 18 December 2020 and remains in Candidate Recommendation Draft status as of 26 March 2025, with ongoing refinements to subgrid track correspondence and sizing contributions. Early browser implementations relied on vendor prefixes, such as -ms- in Internet Explorer 10 (released in 2012) and -webkit- in WebKit-based browsers starting around 2017, before converging on the unprefixed standard following the 2016 Candidate Recommendation. The Grid specification integrates closely with related modules, particularly the CSS Box Alignment Module Level 3, which provides justification and alignment properties (like justify-content and align-content) that extend grid behavior for distributing items and handling gaps across tracks. This alignment ensures consistent behavior with other layout models, such as Flexbox, while maintaining Grid's unique two-dimensional focus.

Key Milestones

The development of CSS Grid Layout began with the publication of its first public working draft on April 7, 2011, marking the start of the modern specification under the . During 2014 to 2016, browser vendors conducted experimental implementations using vendor prefixes, with introducing partial support via the -ms- prefix in (released in 2012) and extending it in IE11, while and Apple tested -webkit- prefixed versions in Chrome Canary and Safari Technology Preview builds. In March 2017, unprefixed support for CSS Grid Layout Module Level 1 arrived in major browsers, including 57 (released March 9), 52 (March 7), and 10.1 (March 13), enabling widespread experimentation despite the specification remaining in Candidate Recommendation status at the time. Full support in 16 followed on October 17, 2017, completing desktop browser coverage for Level 1 features, while mobile browsers such as for Android 57 and on 10.3 aligned with their desktop counterparts by early 2018, achieving broad adoption across devices. The CSS Grid Layout Module Level 1 specification received an updated Candidate Recommendation Draft on 18 December 2020, incorporating implementation feedback while remaining in CR status. Subgrid functionality, introduced in Level 2, saw initial experimental support in 71 on December 3, 2019, followed by stable implementation in 16 on September 12, 2022, and 117 (and subsequent versions) on September 12, 2023, enabling nested grids to inherit parent track sizing for more precise alignments. By 2025, CSS Grid enjoys near-universal support across all modern browsers and devices, with ongoing advancements including updates to Levels 1 and 2 drafts on March 28, 2025, and experimental layout features in Level 3 drafts, which allow for dense, variable-height item packing without fixed rows.

Browser Support and Compatibility

Current Support Levels

As of November 2025, the core features of CSS Grid Layout Level 1 enjoy widespread adoption, with approximately 94.91% global browser usage support. Full implementation is available in starting from version 57 (March 2017), from version 52 (March 2017), from version 10.1 (September 2016), and from version 16 (April 2017). All major mobile browsers, including for from version 57 (April 2017) and from version 10.3 (March 2017), have provided full support since 2017. Advanced features show strong but slightly lower compatibility. For instance, the subgrid functionality from CSS Grid Level 2 has 88.92% global support, with full implementation in and from version 117 (September 2023), from version 71 (October 2019), and from version 16 (September 2022). Similarly, the repeat(auto-fill) and repeat(auto-fit) functions within grid-template-columns achieve 94.61% global support, aligned closely with core grid properties, though versions 57 to 75 offered only partial support limited to a single repeated column. Partial support persists in legacy browsers, notably Internet Explorer 11, which implements an older, non-standard version of the specification lacking key modern features like explicit grid placement and requiring polyfills for full functionality. Vendor prefixes, such as -webkit- for early experimental implementations, have been deprecated since the standard stabilized around 2019 and are no longer required or recommended for production use in any current browser.
FeatureChrome/EdgeFirefoxSafariNotes
Core Grid (Level 1)57+ / 16+52+10.1+Full support; 94.91% global. IE11 partial (older spec).
Subgrid (Level 2)117+ / 117+71+16+88.92% global; no support in older versions.
repeat(auto-fill/fit)57+ / 16+76+ (partial 57-75)10.1+94.61% global; aligns with core.

Polyfills and Fallbacks

Polyfills for CSS Grid Layout provide JavaScript-based implementations to enable the feature in browsers lacking native support, such as older versions of . One notable library is the css-grid-polyfill developed by FremyCompany, which emulates core Grid properties like grid-template-columns, grid-template-rows, and grid-auto-flow for prototyping in IE9+ and other legacy environments. However, this polyfill, last updated in , has limitations including no support for subgrid, sensitivity to box-sizing changes, and potential conflicts with asynchronous layouts or fixed-positioned items. For browsers like IE11, which offer only partial support for an earlier Grid specification, developers historically used polyfills or adapted layouts with Flexbox as a fallback mechanism to approximate two-dimensional arrangements. These approaches, while functional for basic grids, cannot fully replicate advanced features like grid areas or fractional units without performance overhead from JavaScript intervention. Fallback strategies emphasize , where layouts degrade gracefully without Grid. The @supports at-rule allows conditional application of Grid styles only in supporting browsers, defaulting to alternatives like Flexbox or floated elements for unsupported ones. For instance, a container might use display: for one-dimensional alignment as a , then switch to display: within an @supports block for enhanced two-dimensional control.
.container {
  display: flex;
  flex-wrap: wrap;
}

@supports (display: grid) {
  .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }
}
This example ensures a responsive using Flexbox in browsers while leveraging Grid's superior alignment in modern ones. To validate these implementations, tools like enable testing across real devices and browser versions, confirming fallback behaviors without native hardware access. In 2025, with CSS Grid achieving 94.91% global browser support, polyfills and extensive fallbacks are rarely necessary, as legacy usage falls below 5%. Developers are advised to prioritize mobile-first designs and feature detection via @supports, avoiding polyfills unless targeting niche enterprise environments with IE11 constraints, to minimize bundle size and improve .

Practical Usage

Common Layout Patterns

CSS Grid layout enables the creation of reusable patterns for common needs, leveraging its two-dimensional structure to define rows and columns efficiently. These patterns often utilize properties like grid-template-columns and grid-auto-flow to achieve responsive and flexible arrangements without relying heavily on . Card grids are a prevalent pattern for displaying galleries or collections of items, such as images or product thumbnails, where columns automatically adjust to the available space. By setting grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)), the grid creates as many tracks as possible while ensuring each is at least 250 pixels wide, collapsing empty tracks to optimize space on varying screen sizes. This approach, combined with grid-auto-flow: row dense for filling gaps left by items of differing heights, supports dense packing in layouts like photo galleries. Sidebar layouts provide a structured way to organize content into asymmetric columns, typically with a fixed-width sidebar alongside a flexible main area. A common declaration is grid-template-columns: 200px 1fr, which allocates a 200-pixel sidebar and allows the remaining space for the primary content, often enhanced with grid-template-areas to name regions like "sidebar" and "main" for intuitive item placement. Responsive variants adjust this at breakpoints, such as switching to a single column below 500 pixels by redefining the template to 1fr. Magazine-style layouts mimic print designs by employing multi-column grids where articles or sections span varying numbers of tracks. Using a 12-column system defined as grid-template-columns: repeat(12, 1fr) with named lines (e.g., [col-start] repeat(12, 1fr)), elements can be positioned via grid-column: col-start / span 4 to cover four columns, enabling flexible arrangements for headlines, images, and body text that adapt across devices. This pattern draws on track sizing functions like fr units for proportional distribution. Responsive navigation menus benefit from CSS Grid's ability to control flow and direction, stacking items vertically on and arranging them horizontally on larger screens. The grid-auto-flow property defaults to row-wise placement but can be set to column for , while integrating with (e.g., at 700 pixels and above) allows horizontal alignment using companion Flexbox for spacing. This ensures seamless transitions in layouts combining with sidebars or headers. An example of these patterns in action is an product , which adapts card-based items to screen size using repeat(auto-fit, minmax(250px, 1fr)) for columns that reflow from one on small devices to multiple on desktops, incorporating spans for featured products and auto-placement for uniform distribution. Such maintain readability and usability across viewports by relying on intrinsic sizing functions like minmax() and repeat().

Holy Grail Layout Example

The layout is a classic pattern featuring a full-width header at the top, a footer at the bottom, and a central area divided into three columns: a left sidebar (often for ), a main content area, and a right sidebar (typically for advertisements or supplementary information). This structure aims to create equal-height columns without relying on fixed widths for the main content, allowing it to expand fluidly while keeping sidebars at consistent widths. The layout can optionally incorporate sticky positioning for the header and footer to remain visible during scrolling, though this is achieved separately via CSS properties like position: sticky. CSS Grid implements the layout efficiently using a single container element and the grid-template-areas property to define named regions, which map directly to the layout's sections. This approach leverages grid areas for intuitive placement, such as assigning "header" to span the full top row, "nav main aside" to the middle row for the three columns, and "footer" to span the bottom row. The grid-template-columns can set fixed widths for sidebars (e.g., 200px each) and 1fr for the main content to fill the remaining space, ensuring equal heights across columns naturally without additional hacks. For responsiveness, a media query collapses the sidebars by redefining the grid areas to stack vertically on smaller screens, such as mobile devices, where the layout becomes "header" "nav" "main" "aside" "footer" with a single 1fr column. Compared to float-based methods, CSS Grid eliminates common pitfalls like manual clearing of floated elements to prevent layout collapse and simplifies reordering of columns without altering the source order. Floats often required complex workarounds, such as negative margins or pseudo-elements for equal heights, making maintenance difficult, whereas Grid handles two-dimensional positioning natively. In a table-based version of the layout, developers historically nested <table> elements—such as an outer table for header and footer rows, and an inner table for the three-column body—resulting in semantically incorrect markup that conflated layout with content structure, leading to poor and slow rendering. With CSS Grid, the same visual outcome is achieved using elements in a single grid container, improving maintainability and performance without the rigidity of table cells. Here is a complete example implementing the Holy Grail with CSS : HTML:
html
<div class="container">
  <header>Header</header>
  <nav>Left Sidebar ([Navigation](/page/Navigation))</nav>
  <main>Main [Content](/page/Content)</main>
  <aside>Right Sidebar</aside>
  <footer>Footer</footer>
</div>
CSS:
css
* {
  box-sizing: border-box;
  margin: 0;
  padding: [0](/page/0);
}

[body](/page/Body) {
  font-family: [sans-serif](/page/Sans-serif);
}

.container {
  [display](/page/Display): [grid](/page/Grid);
  grid-template-areas: 
    "header header header"
    "nav main aside"
    "footer footer footer";
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: [auto](/page/Auto) 1fr [auto](/page/Auto);
  grid-gap: 10px;
  [height](/page/Height): 100vh;
  padding: 10px;
}

header {
  grid-area: header;
  background-color: #333;
  color: white;
  padding: 1rem;
  text-align: center;
}

nav {
  grid-area: nav;
  background-color: #ddd;
  padding: 1rem;
  margin-left: 0.5rem;
}

main {
  grid-area: main;
  background-color: #f4f4f4;
  padding: 1rem;
}

aside {
  grid-area: aside;
  background-color: #ddd;
  padding: 1rem;
  margin-right: 0.5rem;
}

footer {
  grid-area: footer;
  background-color: #333;
  color: white;
  padding: 1rem;
  text-align: center;
}

@media (max-width: 768px) {
  .container {
    grid-template-areas: 
      "header"
      "nav"
      "main"
      "aside"
      "footer";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    padding: 0;
  }

  nav,
  aside {
    margin: 0;
  }
}
This code produces a desktop layout with fixed sidebar widths and fluid main content, collapsing to a stacked mobile version below 768px viewport width, demonstrating Grid's responsive capabilities.

Integration with CSS Frameworks

Since the widespread browser support for CSS Grid beginning in 2017, major CSS frameworks have increasingly adopted native Grid properties over custom or Flexbox-only systems, enabling more performant and flexible layouts with reduced CSS overhead for lighter bundles. Bootstrap evolved its grid system in version 5.1 (released in 2021) to include an opt-in CSS mode, allowing developers to replace traditional Flexbox-based rows and columns with native utilities. This integration, which remains experimental and opt-in in the latest version 5.3.8 (August 2025), uses classes such as .grid to set display: grid on containers and .g-col-* (e.g., .g-col-6) to define column spans via grid-column, supporting responsive breakpoints like .g-col-md-4 for medium screens and beyond. Tailwind CSS maps utility classes directly to CSS Grid properties, with grid enabling the layout mode, grid-cols-* (e.g., grid-cols-12) specifying column tracks via grid-template-columns: repeat(n, minmax(0, 1fr)), and gap-* (e.g., gap-4) applying the gap property for spacing between items. Version 3.4, released in December 2023, introduced subgrid support through grid-cols-subgrid, which inherits column tracks from a parent grid via grid-template-columns: subgrid; this support continues in v4.0 (January 2025). For instance, Tailwind simplifies a layout compared to CSS. In Tailwind:
html
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 h-screen">
  <aside class="md:col-span-1 bg-gray-100 p-4">Sidebar</aside>
  <main class="md:col-span-3 bg-white p-4">Dashboard Content</main>
</div>
This creates a single-column stack on small screens (grid-cols-1) that expands to four columns on medium screens (md:grid-cols-4), with the sidebar spanning one column (md:col-span-1) and main content spanning three (md:col-span-3), plus uniform gaps (gap-6). The equivalent CSS requires explicit declarations:
css
.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  height: 100vh;
}
@media (min-width: 768px) {
  .dashboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .sidebar {
    grid-column: span 1;
    background-color: #f3f4f6;
    padding: 1rem;
  }
  .main {
    grid-column: span 3;
    background-color: white;
    padding: 1rem;
  }
}
This utility-based approach in Tailwind streamlines implementation while leveraging native performance. Bulma employs a hybrid Flexbox- and Grid-capable system, using Flexbox for its core responsive grid utilities like .columns and .column classes while permitting native CSS Grid integration for advanced two-dimensional layouts beyond Flexbox's one-dimensional limitations. This structure is maintained in the latest v1.0 (December 2024).

Custom Grid Systems

Custom grid systems in CSS Grid Layout enable developers to craft bespoke utilities tailored to project-specific needs, such as adhering to design system principles or enhancing performance by minimizing overhead. These systems typically start with design tokens, which serve as configurable variables defining core layout parameters like breakpoints, column counts, and spacing scales. For example, column counts often default to 12 or 16 for flexibility in dividing content, with breakpoints set at widths such as 480px for mobile, 768px for tablet, and 1024px for desktop to trigger layout shifts via media queries. Spacing scales, expressed as CSS custom properties like --grid-gap: 1rem, ensure consistent gutters between grid tracks using the gap property. Preprocessors like Sass or Less facilitate the generation of utility classes through , automating repetitive declarations to produce scalable CSS. A typical might output a class such as .grid--12 { display: [grid](/page/Grid); grid-template-columns: repeat(12, 1fr); }, where repeat() creates equal-width tracks, and variations can be parameterized for different column numbers or include settings. This approach allows for dynamic class creation, such as looping over column counts to build .grid--n utilities, streamlining maintenance in large codebases. Advanced custom systems incorporate subgrid to enable nested components to inherit and align with the parent grid's track sizing and lines, ensuring precise component-level layouts without hardcoded dimensions. For instance, setting grid-template-columns: subgrid on a child grid allows it to participate in the parent's column distribution, ideal for aligning elements like navigation items or form fields across sections. Complementing this, container queries support modular sizing by conditioning styles on the container's inline size rather than the viewport, using declarations like @container (min-width: 300px) { .grid-item { grid-column: span 2; } } to adapt grid spans dynamically within embedded components. These custom systems offer key benefits, including fine-tuned alignment with brand guidelines through token-driven consistency and reduced bundle size compared to comprehensive frameworks, which often include extraneous utilities. By focusing solely on grid needs, developers achieve optimized, lightweight layouts that enhance load times and specificity control. A practical example is a Sass for a 16-column responsive , where columns adjust per for fluid adaptation. The uses a of and generates media-query-wrapped classes:
scss
$breakpoints: (
  'mobile': 480px,
  'tablet': 768px,
  'desktop': 1024px
);

@mixin grid-system($base-columns: 16, $gap: 1rem) {
  display: grid;
  grid-template-columns: repeat(4, 1fr); // Mobile default
  gap: $gap;

  @each $breakpoint, $width in $breakpoints {
    @media (min-width: $width) {
      grid-template-columns: repeat(#{$base-columns}, 1fr);
    }
  }
}

// Usage
.grid-container {
  @include grid-system(16, 1.5rem);
}
This compiles to output CSS such as:
css
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (min-width: 480px) {
  .grid-container {
    grid-template-columns: repeat([16](/page/16), 1fr);
  }
}

@media (min-width: 768px) {
  .grid-container {
    grid-template-columns: repeat([16](/page/16), 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-container {
    grid-template-columns: repeat([16](/page/16), 1fr);
  }
}
Such generation ensures a cohesive, responsive structure while keeping the codebase .

References

  1. [1]
    CSS Grid Layout Module Level 1 - W3C
    Mar 26, 2025 · This CSS module defines a two-dimensional grid-based layout system, optimized for user interface design. In the grid layout model, the children ...
  2. [2]
    CSS grid layout - MDN Web Docs
    Jul 14, 2025 · The CSS grid layout module excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer.Basic concepts of grid layout · Aligning items in CSS grid layout · CSS inline layout
  3. [3]
    CSS Grid Layout (level 1) | Can I use... Support tables for ... - CanIUse
    "Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
  4. [4]
    The Story of CSS Grid, from Its Creators - A List Apart
    Oct 19, 2017 · In 1996, Bos, Lie, and Dave Raggett came up with a “frame-based” layout model. Then, in 2005, Bos released the Advanced Layout Module, which ...
  5. [5]
    Three years with CSS Grid Layout - Rachel Andrew
    Nov 3, 2015 · The 'modern' CSS Grid Layout specification began as a first public working draft published on 7 April 2011. The majority of the editors of that ...
  6. [6]
    Basic concepts of grid layout - CSS | MDN
    ### Extracted and Summarized Content from MDN CSS Grid Layout Basics
  7. [7]
    Relationship of grid layout to other layout methods - CSS | MDN
    Oct 30, 2025 · For example, if you are setting a width on a flex item to make it line up with other items in a row above, a grid is likely a better choice.Missing: advantages | Show results with:advantages
  8. [8]
    Grid layout and accessibility - CSS - MDN Web Docs
    Jul 14, 2025 · Grid layout gives authors great powers of rearrangement over the document. However, these are not a substitute for correct ordering of the document source.
  9. [9]
    Grid, content re-ordering and accessibility - Rachel Andrew
    Jun 4, 2019 · Source order is a good default, if you are taking advantage of normal flow, a lot of the time following the source is exactly what you want.
  10. [10]
    Performance analysis of Grid Layout – make everything intensely
    Jun 24, 2015 · Grid Layout beats Flexbox using the default values for CSS properties controlling layout itself and alignment, which is stretch for these containers.
  11. [11]
  12. [12]
  13. [13]
  14. [14]
  15. [15]
  16. [16]
  17. [17]
  18. [18]
  19. [19]
  20. [20]
  21. [21]
    Basic concepts of grid layout - CSS - MDN Web Docs
    The explicit grid consists of rows and columns defined with grid-template-columns or grid-template-rows . The implicit grid extends the defined explicit grid ...Relationship of grid layout to... · Grid Tracks · Layout using named grid lines
  22. [22]
  23. [23]
  24. [24]
  25. [25]
  26. [26]
  27. [27]
  28. [28]
  29. [29]
  30. [30]
  31. [31]
  32. [32]
  33. [33]
  34. [34]
  35. [35]
  36. [36]
    Grid template areas - CSS - MDN Web Docs
    Oct 29, 2025 · The property is referred to as the explicit grid shorthand because it sets values that you control when you define an explicit grid, and not ...
  37. [37]
    CSS Grid Layout Guide
    Aug 21, 2025 · Our comprehensive guide to CSS grid, focusing on all the settings both for the grid parent container and the grid child elements.
  38. [38]
  39. [39]
  40. [40]
  41. [41]
  42. [42]
  43. [43]
  44. [44]
  45. [45]
  46. [46]
  47. [47]
  48. [48]
  49. [49]
  50. [50]
  51. [51]
  52. [52]
  53. [53]
  54. [54]
  55. [55]
    minmax() - CSS | MDN
    - **Definition**: `minmax()` CSS function defines a size range ≥ min and ≤ max, used with CSS grids.
  56. [56]
  57. [57]
    repeat() - CSS - MDN Web Docs - Mozilla
    Oct 10, 2025 · The repeat() CSS function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be ...Try it · Syntax · Formal syntax · Examples
  58. [58]
  59. [59]
  60. [60]
  61. [61]
    CSS Grid Layout Module Level 2 - W3C
    Mar 26, 2025 · This CSS module defines a two-dimensional grid-based layout system, optimized for user interface design. In the grid layout model, the children ...Grid Layout Concepts and... · Grid Items · Defining the Grid · Grid Layout Algorithm
  62. [62]
    Nested grid performance in Safari · Issue #60 · rachelandrew/gridbugs
    Nov 16, 2022 · Multiple nested grids are causing very slow performance on safari, making subgrid pretty much unusable.
  63. [63]
    Debugging CSS Grid: Part 1: Understanding Implicit Tracks
    Apr 30, 2019 · So, how can we best avoid running into problems with implicit tracks? One way is to understand how Grid is calculating our layout behind the ...Missing: pitfalls | Show results with:pitfalls
  64. [64]
    How to Use CSS Grid for Customizable Dashboard Layouts
    Nested grids allow you to create complex layouts within a single grid item. This can be particularly useful for dashboards with sections that require their own ...
  65. [65]
    Grid Layout - W3C
    Apr 7, 2011 · The Grid provides a mechanism for authors to divide available space for lay out into columns and rows using a set of predictable sizing behaviors.
  66. [66]
  67. [67]
    CSS Grid Layout Module Level 2 - W3C
    Feb 6, 2018 · Subgrids provide the ability to pass grid parameters down through nested elements, and content-based sizing information back up to their parent ...
  68. [68]
    CSS Box Alignment Module Level 3 - W3C
    Mar 11, 2025 · This module contains the features of CSS relating to the alignment of boxes within their containers in the various CSS box layout models.Alignment Keywords · Self-Alignment: Aligning the... · Baseline Alignment Details
  69. [69]
    CSS Grid Layout 2014 Recap: Implementation Status - Planet Igalia
    Jan 8, 2015 · This post will try to cover what we've been doing in Igalia during 2014 around grid layout, and it'll talk about our plans for 2015.Work Done In 2014 # · Named Grid Lines # · Plans For 2015 #Missing: 2014-2016 | Show results with:2014-2016
  70. [70]
    Should I try to use the IE implementation of CSS Grid Layout?
    Nov 26, 2016 · The Grid implementation that is in IE10, IE11 and current Edge is an implementation based on the 2011 specification for CSS Grid Layout.Missing: 2014-2016 | Show results with:2014-2016
  71. [71]
    CSS Grid Layout is Here to Stay - Planet Igalia
    Mar 16, 2017 · 🚀 In the past week, Chrome 57 and Firefox 52 were released, becoming the first browsers to ship CSS Grid Layout unprefixed (Explorer/Edge has ...
  72. [72]
    Browser Support for CSS Grid Layout - Grid by Example
    Mar 7, 2017 · Firefox were first to land grid support, on the 7th March 2017 in Firefox 52. ... Safari 10.1 and iOS Safari support CSS Grid as of March 27, 2017 ...Missing: unprefixed | Show results with:unprefixed
  73. [73]
    Subgrid - CSS - MDN Web Docs
    Oct 30, 2025 · You can "nest" grids by making a grid item a grid container. These grids, however, are independent of the parent grid and of each other, meaning ...Introduction to subgrid · Subgrid for columns · Subgrid for rows · Named grid lines
  74. [74]
    WebKit Features in Safari 16.0
    Sep 12, 2022 · In Safari 16, you can now animate track sizes in CSS Grid, dynamically changing the size of rows and columns. Safari 16 also adds support ...Missing: date | Show results with:date
  75. [75]
    New in Chrome 117 | Blog
    Sep 12, 2023 · Chrome 117 includes new CSS features for animations, array grouping, streamlined local overrides in DevTools, and subgrid support.
  76. [76]
    CSS Grid: Level 1 & 2 updated, Level 3 (masonry layout) reworked
    Mar 28, 2025 · The update to Levels 1 & 2 are largely adjustments to the core layout algorithm (see changes); the update to Level 3 (which was published in ...
  77. [77]
  78. [78]
    CSS Subgrid | Can I use... Support tables for HTML5, CSS3, etc
    "Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
  79. [79]
    CSS property: grid-template-columns: `repeat()` | Can - CanIUse
    2 repeat(auto-fill, ...) and repeat(auto-fit, ...) only support one repeated column (see bug 1341507). Support data for this feature provided by: MDN ...
  80. [80]
    FremyCompany/css-grid-polyfill: A working implementation ... - GitHub
    Welcome to this first version of the CSS-Grid-Polyfill. The goal of this project is to provide a working implementation of css grids for current browsers, for ...
  81. [81]
    How @supports Works - CSS-Tricks
    Feb 25, 2019 · The “fallback” is the code outside of the @supports block (the properties above the block in the example above), and the grid code is either ...
  82. [82]
    Cross Browser Testing using Selenium WebDriver: Tutorial
    Learn how to get started with cross browser testing using Selenium with examples. Read about best practices to follow for multi browser testing in Selenium.
  83. [83]
    How to think about Baseline and polyfills | Articles - web.dev
    Mar 18, 2025 · Knowing when to use a polyfill for a feature depends on its availability across browsers, and Baseline can be helpful in making that determination.What Are The Disadvantages... · Determine Your Baseline... · When And When Not Polyfill A...
  84. [84]
  85. [85]
    CSS Grid: Holy Grail Layout - DigitalOcean
    Apr 4, 2022 · Holy Grail is a layout pattern that's very common on the web. It consists of a header, a main content area with fixed-width navigation on the left, content in ...
  86. [86]
    The Holy Grail Layout with CSS Grid
    Jan 27, 2021 · How to build a very common layout with CSS grid. Header on the top, footer on the bottom. Two columns, sidebar and main content.
  87. [87]
    CSS Grid
    ### Summary of Bootstrap 5 CSS Grid Integration
  88. [88]
    Tailwind CSS v3.4: Dynamic viewport units, :has() support, balanced ...
    Dec 19, 2023 · Tailwind CSS v3.4: Dynamic viewport units, :has() support, balanced headlines, subgrid, and more · Subgrid support · Extended min-width, max-width ...
  89. [89]
    grid-template-columns - Flexbox & Grid - Tailwind CSS
    Utilities for specifying the columns in a grid layout ... Implementing a subgrid. Use the grid-cols-subgrid utility to adopt the column tracks defined by the ...Missing: support | Show results with:support
  90. [90]
    Grid - Bulma CSS
    Bulma is a free, open source CSS framework based on Flexbox and built with Sass. It's 100% responsive, fully modular, and available for free.Bulma Grid Playground · Smart Grid · Fixed Grid · Grid CellsMissing: utilities | Show results with:utilities
  91. [91]
    IBM 2x Grid - Carbon Design System
    Within a breakpoint, the column count is constant, and unit size scales with screen size. Choose a column count by starting with one, then divide by two as ...
  92. [92]
    Responsive layout grid - Material Design 2
    The number of columns displayed in the grid is determined by the breakpoint range, a range of predetermined screen sizes. A breakpoint can correspond with ...Missing: tokens | Show results with:tokens
  93. [93]
    A very simple grid system built with SASS and CSS grid - GitHub Gist
    You create a row of which the children stack on top of one another on mobile devices, and become columns on desktop computers.
  94. [94]
    CSS subgrid | Articles - web.dev
    Sep 28, 2023 · Chrome, Edge, Firefox and Safari all have great CSS grid DevTools, and Chrome, Edge and Firefox have specific tools for helping with subgrid.
  95. [95]
    CSS Container Queries
    Sep 26, 2024 · The main idea of CSS Container Queries is to register an element as a “container” and apply styles to other elements when the container element meets certain ...
  96. [96]
    CSS Grid Layout vs CSS Frameworks: When To Use What?
    Nov 18, 2019 · CSS Grid layouts allows developers to build custom complex layouts with absolute control only by using Native CSS properties without relying on any frameworks.
  97. [97]
    CSS Frameworks Or CSS Grid: What Should I Use For My Project?
    Nov 9, 2018 · The question of whether to use Grid or a framework is flawed, as CSS Grid is not a drop-in replacement for the things that a CSS framework does.
  98. [98]
    How to Build a Grid System in Sass Using a Simple Handwritten ...
    A working example of implementing a grid system in Sass using a simple handwritten single-pass compiler.