Skip to content

Section headings are styled unevenly (solution included) #2191

@ArthurClemens

Description

@ArthurClemens

Headings "Summary", "Callbacks" and "Functions" are styled differently than headings with other titles.
These other headings are displayed quite a bit larger. These include the heading "Types", and custom headings generated by the @doc group tag (see screenshots below).

This is caused by very specific CSS selectors that include the section name-as-identifiers for "Summary", "Callbacks" and "Functions":

:is(#summary, #callbacks, #functions)>h1.section-heading
:is(#summary, #callbacks, #functions)>h2.section-heading

The selectors exclude sections with other IDs.

Changes

The currently generated HTML contains class name details-list that is unused by CSS.
This class can be used instead of the specific ID selectors.

In general.css, change:

& h2,
& :is(#summary, #callbacks, #functions)>h1.section-heading {
  font-size: var(--h2-size);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

& h3,
& :is(#summary, #callbacks, #functions)>h2.section-heading,
& #summary :is(.summary-callbacks, .summary-functions) h2 {
  font-size: var(--h3-size);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

to:

& h2,
.details-list h1 {
  font-size: var(--h2-size);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

& h3,
.details-list h2 {
  font-size: var(--h3-size);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

Screenshots current layout

Side-by-side comparison of a regular page and a page with heading "Types"

The Types heading inside Summary should be styled as h3 instead of h2.
The Types heading at the same level as Summary should be styled as h2 instead of h1.

Image

Screenshots new layout

Side-by-side comparison of a regular page and a page with heading "Types"

The Types headings are aligned with the Function headings.

Image

Side-by-side comparison of a page with headings for a custom group

Left the current styling, right the updated styling.
At the right side, the custom heading is aligned with the Summary heading.

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions