Use this file to discover all available pages before exploring further.
The container is Tidgrid’s foundational layout primitive. Apply .tg-container to any block element and it will center itself horizontally inside its parent using automatic margin-left and margin-right calculations, while keeping a minimum 2rem gutter on each side so content never bleeds to the viewport edge. The base class is also fully responsive — it steps through every breakpoint automatically. For tighter control, the named breakpoint variants let you hard-cap the container’s maximum width at a specific size.
.tg-container centers content and respects all five breakpoints without any additional classes. Under the hood, Tidgrid uses calc with max() and min() to derive the correct margins so the container stays flush-centered as the viewport grows.
html
<body> <div class="tg-container"> <!-- content is centered with 2rem gutters on each side --> </div></body>
The compiled CSS for the base class looks like this — the margin and max-width expressions update at every breakpoint media query:
The max(2rem, …) expression ensures the side gutter never collapses below 2rem even on very narrow viewports, so your content is never flush against the screen edge.
When you want to fix the container’s width ceiling at a specific breakpoint — for example, a narrow blog post column or a medium-width dashboard — add a breakpoint key in parentheses. The variant’s max-width is locked to that breakpoint value regardless of how wide the viewport gets.
Class
Max-width cap
Pixels (approx.)
tg-container(xs)
36em
576 px
tg-container(sm)
48em
768 px
tg-container(md)
64em
1024 px
tg-container(lg)
75em
1200 px
tg-container(xl)
90em
1440 px
Each variant applies the same calc + max/min centering approach as the base class, but with the chosen breakpoint value substituted as the fixed max-width ceiling.
.tg-container pairs directly with Tidgrid’s .tg-row and .tg-cell grid system. Place a container around your rows to keep the entire grid centered and respecting your chosen max-width. The container imposes no flex context of its own, so row and cell behaviour is unaffected.
The $margin variable controls the left and right gutter for every container variant. Override it before importing Tidgrid to adjust the default 2rem gutters globally.
scss
// _tidgrid-config.scss — import before tidgrid// Change both gutters to 1.5rem$margin: (left: 1.5rem, right: 1.5rem);@use "tidgrid";
You can also set asymmetric gutters:
scss
// Wider right gutter for a sidebar-style offset$margin: (left: 1rem, right: 3rem);@use "tidgrid";
The $margin variable is declared with !default in src/layout/container.scss, which means any value you assign before the @use takes effect without needing to override an existing rule.