Skip to content

Tailwind 4: first-child resets for margin-top missing when type scale is added with a breakpoint prefix #383

@danieltott

Description

@danieltott

What version of @tailwindcss/typography are you using?

v0.5.16

What version of Node.js are you using?

22.13 locally, also happening on Tailwind Play

What browser are you using?

Chrome, Firefox

What operating system are you using?

mac

Reproduction repository

https://play.tailwindcss.com/FbG6fLD0eT

Describe your issue

In .prose, non-h1 headings by default have a margin-top applied. If the heading is the first child, then there is css that resets margin-top to 0.

When you add a size modifier (prose-lg etc), there is an updated margin-top value, and an additional updated margin-top:0 for :first-child for each heading.

When you add a type scale with a breakpoint prefix (ie lg:prose-lg), there is an adjusted margin-top value in a media query, but they are missing the related margin-top:0 for :first-child situations.

I created a Tailwind Play link that describes this: https://play.tailwindcss.com/FbG6fLD0eT

Here are some screenshots

Just .prose (good):

Image

Image

Size modifier: .prose.prose-sm (good):

Image

Image

Size modifier + breakpoint prefix (bad):

Image

Image

Metadata

Metadata

Assignees

No one assigned

    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