Skip to content

Styles are appllied in incorrect order #2495

Description

@jgosmann

Describe the bug

I have a styles.css with the following content:

h2 {
    font-size: 2rem;
}

Up to and including Slidev 52.9.1, this took effect as expected on slides with layout: none. (Other layouts, at least with the default theme, have a .slidev-layout h2 rule with higher specificity.) But since version 52.10.0 (and still with version 52.14.1), another rule with font-size: inherit takes precedence.

Looking at the computed CSS in the dev tools in version 52.9.1 shows this:

Image

With version 52.10.0 this changed to:

Image

Note that the order of 2rem and inherit is swapped.

I suspect that his is related to:

#2380, #2412, #2439, #2457

Minimal reproduction

I created a minimal reproduction in jgosmann/slidev-styles-bug.. It is a freshly created Slidev presentation. The second slide shows the problem. It has an h2-heading that should have the font-size styled with styles.css, but the style is overridden with a default.

Environment

  • Slidev version: 52.10.0 and 52.14.1
  • Browser: Firefox 148.0.2
  • OS: macOS Tahoe 26.3.1 (a)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions