Create a twelve-column CSS Grid by making the container a grid and defining twelve equal fractional columns: grid-template-columns: repeat(12, 1fr). Place items using grid lines or spans, then adjust those placements—or redefine the columns—when the content needs to adapt to narrower screens.
Build the basic 12-column grid
Apply display: grid and grid-template-columns: repeat(12, 1fr) to the parent. Each 1fr track receives an equal share of the space available to the grid tracks. The gap property sets the spacing between tracks; it is part of the layout, so choose a value that suits the design.
.layout {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 1.25rem;
}
This creates the column structure, but does not automatically assign items to particular columns. Use grid line numbers or spans to place them.
Place items with grid lines and spans
Grid lines mark the boundaries around the tracks. A twelve-track grid has thirteen numbered vertical lines, so grid-column: 1 / 13 starts at the first line and ends at the thirteenth, spanning all twelve columns.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
<div class="layout">
<header>Site header</header>
<aside>Related links</aside>
<main>Main article</main>
<footer>Site footer</footer>
</div>
.layout {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 1.25rem;
}
header,
footer {
grid-column: 1 / 13;
}
aside {
grid-column: 1 / 4;
}
main {
grid-column: 4 / 13;
}
Here, the header and footer cover the full grid. The aside uses the first three tracks, while the main area begins at line 4 and ends at line 13. You can also specify a start line and a span, such as grid-column: 4 / span 9, to express that an item should occupy nine tracks from its starting line.
These line-based placements follow the approach in MDN’s CSS Grid layout guide. The example’s gap is a design choice, not a required value.
Rank #2
Make the layout responsive
A twelve-column system does not mean an item has to remain narrow on a small screen. At a breakpoint where the content no longer fits comfortably, change item spans or define a different grid. Set the breakpoint based on the content and available space rather than assuming one screen width works for every layout.
Keep twelve tracks and change item spans
One option is to retain the twelve tracks while changing how items are placed at a media-query breakpoint. This preserves the grid’s underlying structure while letting content use more of its width on smaller screens. MDN demonstrates responsive layouts that adjust item spans this way in its common grid layouts guide.
Redefine the grid at a breakpoint
If the twelve-column structure no longer suits the available width, define fewer columns in a media query. For example, a layout with separate sidebar and main areas on a wide screen might stack them on a narrow one. Choose the change based on what the content needs; there is no universally correct breakpoint.
Use named lines for repeated placements
Named lines can make placement rules easier to read when the same grid positions appear repeatedly. This form names each repeated line col-start:
Rank #4
.wrapper {
display: grid;
grid-template-columns: repeat(12, [col-start] 1fr);
gap: 1.25rem;
}
.content {
grid-column: col-start 4 / span 9;
}
The named line makes the intent more descriptive than relying only on a line number. It is optional; use it when it improves the clarity of your layout rules. MDN documents this pattern in its guide to common grid layouts.
When to use auto-fitting columns instead
A twelve-column grid is useful when multiple regions need predictable spans and alignment. If the number of columns should instead follow the available width, consider an auto-fitting grid:
Best Value
.cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
gap: 1rem;
}
This example asks Grid to fit as many columns as it can, with a minimum track size of 230 pixels and flexible space above that. The minimum is an example to tune for the content, not a universal recommendation. MDN explains both this adaptive pattern and the basics of tracks, lines, and gaps in its basic concepts guide.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common problems and fixes
- An item spans too many columns: Check its start and end lines. To span all twelve tracks, use
1 / 13; ending at line 12 covers only through the track before line 12. - Items do not line up as expected: Confirm that the grid declaration is on the parent that contains the items you are placing. Grid line placement applies to grid items in that grid.
- The layout feels cramped: Reconsider both the track placement and
gap. Gaps take up space between tracks, so they affect how the complete layout fits. - The phone layout stays too wide or crowded: Change item spans or redefine the columns at a content-appropriate breakpoint instead of expecting desktop placements to suit every width.
- The fixed column count is unnecessary: If the layout should create as many columns as fit, use an auto-fitting definition such as
repeat(auto-fit, minmax(...))and choose a suitable minimum track size.
Or skip the browser setup
If you need a screenshot of a published page to inspect the layout, you can request one with ScreenshotNeo. For a page you are developing locally, publish or otherwise make it reachable at a URL the API can access first.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for request options. ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides screenshot and page-information tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →




