avocado
avocado

Reputation: 2735

Image with `full-width` format not centered in Wagtail's RichTextField?

I'm a beginner of Wagtail, and trying to follow the tutorial to build a blog website.

The question I have is about RichTextField, inserting an image in the editor, and I have chosen the "Full Width" format, expecting the image should be centered (as said in the doc).

However it's not centered, as shown in the picture below.

What's wrong?

enter image description here

Upvotes: 1

Views: 451

Answers (1)

gasman
gasman

Reputation: 25227

The docs don't say anything about the image being centred. On the contrary, the developer docs say:

The CSS classes added to images do not come with any accompanying stylesheets, or inline styles. e.g. the left class will do nothing, by default. The developer is expected to add these classes to their front end CSS files, to define exactly what they want left, right or full-width to mean.

So, to centre the image, you could define a CSS rule such as:

img.full-width {
    display: block;
    margin: auto;
}

Upvotes: 4

Related Questions