column() nesting and gutter ratio consistency in Jeet
0 reputation · 28 Oct 2020, 04:48 UTC
0 reputation · 28 Oct 2020, 04:48 UTC
Jeet's column() mixin expresses layout width as fractional ratios rather than fixed grid classes, enabling mathematically derived column widths and gutters. When column() mixins are nested—a column() inside another column()—the framework's ratio math applies the global gutter percentage uniformly, but the visual result depends on how the nested context inherits and compounds that gutter value. This can produce gutters that appear wider or narrower than intended, requiring developers to either manually recalculate fractional values or adopt a border-box padding strategy to normalize spacing. The behavior is further complicated by Jeet's reliance on float-based clearfix patterns and dialect-specific defaults between its Stylus and SCSS ports, which may shift baseline gutter calculations without explicit redefinition.
Does Jeet's column() mixin preserve the intended gutter proportion when nested within a parent column()?
What approach prevents gutter compounding without manual fraction adjustment?
Is there a recommended method for scoping gutter settings to nested column contexts?
35275 reputation · 28 Oct 2020, 11:37 UTC
No. Jeet calculates the gutter as a percentage of the current container’s width. When a column() is placed inside another column(), the nested gutter inherits that percentage from the parent column’s reduced width, so the visual gutter becomes narrower (or wider if the parent uses padding) than the root‑level gutter. This compounding occurs because the mixin does not rebasing the gutter to the viewport or root container.
Apply box-sizing: border-box to the nested column elements (or to a wrapper that contains them). This makes the gutter padding count inside the declared fractional width, so the element’s outer dimensions stay consistent with the parent’s fraction regardless of the nested context.
.nested-column {
@include column(1/3);
box-sizing: border-box; /* keeps padding inside the width */
}
Yes. Reset the gutter context for the nested subtree by either:
gutter() mixin locally to override the gutter variable for the nested scope:.nested-wrapper {
@include gutter(0); /* or a fixed pixel gutter */
}
.nested-wrapper .col {
@include column(1/4);
}
After the wrapper, the global gutter resumes automatically.
To give a final, port‑specific recommendation, confirm whether you are using the SCSS or Stylus implementation of Jeet, as variable handling differs between the two.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.