• Resolved lauritasita

    (@lauritasita)


    @karmatosed – Hey Guys,

    The left and right image alignment is fine, but there are issues with center alignment. It appears correctly in the visual editor, but when you publish the post and then view it, the image defaults to the left.

    I’ve tested under the following conditions:

    Theme: Weaver
    Browser: Firefox

    Theme: Twentysixteen
    Browser: Firefox, Chrome

    My Gutenberg version is 2.5.0 which I believe is current and I’ve been having this issue for almost two days.

    Thank you for looking into this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • 2 months after my first input about this problem they never solved it lost faith in gutenberg team.

    ok they have solved the problem with version 2.6.0

    Thread Starter lauritasita

    (@lauritasita)

    @marius84 – Thank you for telling me. I just tested it out on one of my testing websites and it is functioning the way it should.

    Quite honestly, I don’t know if I’ll be using Gutenberg for a while because all my websites have static pages so they don’t change very often, but it’s nice to know that it’s there if I want to change.

    not sure why this would have been solved in 2.6.0, if the theme CSS has not changed, perhaps gutenberg in 2.6.0 included code to style that class?

    I think this points out one of the problems with using Gutenberg or any other page builder system. in gutenberg, when you add an image block and click on “align center”, all that gutenberg does with the image block is to add the class “aligncenter” to the image block code. it is then up to the theme code to process that class to actually center the image on the post or page. if the class “aligncenter” is not defined in the theme’s css, then the image will not be centered on the page or post when you are looking at it yourself. the image does not get centered by default or automatically.

    I doubt that either Weaver or twentysixteen have a class of aligncenter defined in their CSS code, so the image will not get centered as you would expect it to. somehow, you need to ensure that the CSS required to display your content matches that generated by gutenberg.

    Al

    TwentySixteen does have an aligncenter, apparently, around line 1339 of style.css

    .aligncenter {
    	clear: both;
    	display: block;
    	margin: 0 auto 1.75em;
    }

    I wonder is there a list of the css selectors that Gutenberg assumes?
    That would be handy to add to themes in future.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot center an image’ is closed to new replies.