Repository navigation
Backlog
Labels
bootstrapenhancementNew feature or requestthemesRelated to HTML theming or any other style related issue (like highlight-style)
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
Grid column headers are misaligned on narrow screens in HTML pages that are part of a website, but not standalone HTML documents.
_quarto.yml
project:
type: websiteindex.qmd
---
title: "Grid columns: headings misaligned below the lg breakpoint on narrow screens"
---
::: grid
::: {.g-col-6}
## Left
:::
::: {.g-col-6}
## Right
:::
:::
quarto preview in this directory looks like this on a wide monitor
When I make the window narrower, it looks like this
I think this is due to
| #quarto-content section:first-of-type h2:first-of-type { |
Steps to reproduce
Create these two files in a fresh dir
_quarto.yml
project:
type: websiteindex.qmd
---
title: "Grid columns: headings misaligned below the lg breakpoint on narrow screens"
---
::: grid
::: {.g-col-6}
## Left
:::
::: {.g-col-6}
## Right
:::
:::
run quarto preview and play with the window width.
Actual behavior
No response
Expected behavior
No response
Your environment
- IDE: Positron 2026.11.1 build 4
- OS: MacOS 27.2.1
Quarto check output
❯ quarto check
Quarto 1.11.9
[✓] Checking environment information...
Quarto cache location: /Users/matti/Library/Caches/quarto
Project root: /Users/matti/Documents/quarto-repr
Project config: /Users/matti/Documents/quarto-repr/_quarto.yml
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.10.0: OK
Dart Sass version 1.101.0: OK
Deno version 2.9.8: OK
Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.11.9
Path: /Applications/quarto/binMetadata
Metadata
Assignees
Labels
bootstrapenhancementNew feature or requestthemesRelated to HTML theming or any other style related issue (like highlight-style)
Activity
mcanouil commentedon Nov 24, 2026
Important
Accessibility: To improve accessibility, please add alternative text to your screenshots. This helps all users, including those using screen readers, to understand the context of the images. A brief description can make a big difference! See Good Alt Text, Bad Alt Text — Making Your Content Perceivable.
mcanouil commentedon Nov 24, 2026
Thanks for the report, your guess is right. I could reproduce this on current
main(7a77d06) with the files from the issue.Pandoc wraps each heading in its own
section, so the grid renders as two sibling sections insidediv.grid:The base stylesheet gives every
h2a top margin of2rem.quarto-cli/src/resources/formats/html/bootstrap/_bootstrap-rules.scss
Lines 690 to 699 in 7a77d06
Below the
lgbreakpoint, the website navigation stylesheet then setsmargin-top: 1remon#quarto-content section:first-of-type h2:first-of-type. It is meant for the first heading of the page, but the selector does not require thesectionto be a direct child ofmain.quarto-cli/src/resources/projects/website/navigation/quarto-nav.scss
Lines 86 to 98 in 7a77d06
:first-of-typeis evaluated among siblings, sosection#leftmatches and gets1rem, whilesection#rightis the secondsectionand keeps2rem. That is the 1rem offset you see. Wide screens are fine because the rule only applies belowlg, and standalone HTML never loads the website navigation styles.The base stylesheet already scopes a similar rule to top-level sections, so the
lgrule could be limited the same way.quarto-cli/src/resources/formats/html/bootstrap/_bootstrap-rules.scss
Lines 709 to 711 in 7a77d06
I checked this against the rendered HTML and CSS, not in a browser.
Suggested fix
Scope the
lgrule to top-level sections:Sections nested in a grid or any other layout div would then keep the regular
2rem, so columns stay aligned. I have not tested this change in a browser.