Skip to content

Commit d27bf49

Browse files
committed
Try to improve the padding.
1 parent 58b0073 commit d27bf49

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/block-library/src/image/style.scss‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,15 @@
379379
// to scroll fully covers the image as it moves up over it.
380380
.wp-lightbox-caption-panel {
381381
padding-block: 24px;
382+
// Aligns the caption's left and right edges with the enlarged image
383+
// above it. The image is centered and its width is published as
384+
// `--wp--lightbox-container-width`, so its inset from each edge is half
385+
// of the leftover space. Because that width is recomputed on resize,
386+
// the caption follows the image at every breakpoint — the two are
387+
// separate elements, so a fixed padding could only match at one size.
388+
// The `max()` floor keeps a sane gutter in the brief moment before
389+
// `setOverlayStyles()` publishes the variable.
390+
padding-inline: max(16px, calc((100% - var(--wp--lightbox-container-width, 100%)) / 2));
382391
cursor: default;
383392
}
384393

@@ -391,7 +400,6 @@
391400
// classic themes and block themes that set no content size, where the
392401
// variable is not emitted) keeps the measure readable.
393402
max-width: min(90vw, var(--wp--style--global--content-size, 480px));
394-
padding-inline: 16px;
395403

396404
// Do not set `text-align` here. The element carries the
397405
// `wp-element-caption` class, so caption alignment defined in

0 commit comments

Comments
 (0)