[wp-trac] [WordPress Trac] #54076: Twenty Twenty: image not centered

WordPress Trac noreply at wordpress.org
Wed Sep 8 20:32:36 UTC 2021


#54076: Twenty Twenty: image not centered
----------------------------------------+----------------------------
 Reporter:  damienaa                    |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  5.9
Component:  Bundled Theme               |     Version:  5.8
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:  css, template
----------------------------------------+----------------------------
Changes (by sabernhardt):

 * milestone:  5.8.2 => 5.9


Comment:

 The full image block needs to be centered because that has the width and
 max-width. However, the `aligncenter` class is on the `figure` within a
 `wp-block-image` div element.

 I am having trouble reproducing the lack of a margin on the image block
 within a fresh 5.8 installation. There, the Twenty Twenty styles are
 enqueued after the block-library stylesheet, and the auto side margins
 correctly override the zero. Damien's site enqueues the block-library
 styles later. So the problem may happen with a plugin.

 With the stylesheet order like that, changing `.wp-block-image.is-resized`
 to `.wp-block-image` in Twenty Twenty would **not** work. Adding a
 selector with `body` (or a similar element) might help, if necessary:
 {{{
 body .wp-block-image,
 .wp-block-image.is-resized {
         margin-left: auto;
         margin-right: auto;
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54076#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list