Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Grid column headings are misaligned in HTML websites #15421

Backlog

Description

@mvuorre

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: website

index.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

image

When I make the window narrower, it looks like this

image

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: website

index.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/bin

Activity

  1. added
    bug
    on Nov 24, 2026
  2. added
    enhancement
    and removed
    bug
    on Nov 24, 2026
  3. mcanouil commented on Nov 24, 2026

    @mcanouil
    Collaborator

    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.

  4. mcanouil commented on Nov 24, 2026

    @mcanouil
    Collaborator

    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 inside div.grid:

    <section id="left" class="level2 g-col-6"><h2>Left</h2></section>
    <section id="right" class="level2 g-col-6"><h2>Right</h2></section>

    The base stylesheet gives every h2 a top margin of 2rem.

    Below the lg breakpoint, the website navigation stylesheet then sets margin-top: 1rem on #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 the section to be a direct child of main.

    :first-of-type is evaluated among siblings, so section#left matches and gets 1rem, while section#right is the second section and keeps 2rem. That is the 1rem offset you see. Wide screens are fine because the rule only applies below lg, and standalone HTML never loads the website navigation styles.

    The base stylesheet already scopes a similar rule to top-level sections, so the lg rule could be limited the same way.

    I checked this against the rendered HTML and CSS, not in a browser.

    Suggested fix

    Scope the lg rule to top-level sections:

    #quarto-content main.content > section:first-of-type > h2:first-of-type {
      margin-top: 1rem;
    }

    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.

  5. added
    themes
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bootstrapenhancementthemes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions