Skip to content

Captions do not adhere to image alignment #2726

Description

@gamebits

Describe the bug
When an image is centered, its caption should be as well — but it isn't.

To Reproduce
Steps to reproduce the behavior:

  1. Embed an image block
  2. Center the image
  3. Add a caption
  4. Observe that the caption is centered in the post editor
  5. Preview the post
  6. Observe that the caption in the preview is left-aligned

Screenshots

Tested with Newspack Sacha 2.22.3.

Centered image in post editor:

Image

Image embedded on frontend:

Image

Expected behavior
Captions should consistently adhere to the alignment of its parent image.

More info

Post in question:

https://a2central.com/2026/06/libreoffice-extensions/

Relevant CSS:

//! Image
.wp-block-image {
img {
display: block;
}
figcaption {
text-align: left;
}
img:not([style*="object-fit"]) {
height: auto !important; // !important to override inline styles.
}
// Preventing space under linked images; the wacky structure is to avoid affecting images from migrations that may not have ideal markup.
& > a:has( img ) {
display: block;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions