Image align center not working

Created on 11 April 2020, about 4 years ago
Updated 15 May 2024, about 2 months ago

What are the steps required to reproduce the bug?
1. Create or edit a node (I am using Basic Page type for this)
2. Insert an image using the CKEditor media widget. Select "center" as the alignment. The image appears centered in the Editor pane.
3. Preview the node - the image is now left aligned.
4. Save the node.
5. View the node. The image still appears as left aligned.

What behavior were you expecting?
* Expecting the the image will be centered when align = center is selected.

What happened instead?
* The image is left-aligned.

Additional info:
* Left and Right alignment options work. Only center does not.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada ciesinsg

    For anyone using a custom theme who is stuck with this, I was able to fix this using the below CSS:

    article {
      width: fit-content;
    }
    

    I went through a lot of steps finding the issue. It turned out that the media was being added correctly, and while the image element itself was missing align: centre, but a few levels up the parent elements did get this attribute. I played in the browser a bit and found that by setting article to fit-content, it suddenly worked.

Production build 0.69.0 2024