Skip to content

Commit

Permalink
Media & Text block: Fix nested Media & Text block media position issu…
Browse files Browse the repository at this point in the history
…e with increased CSS specificity (#62184)

* Refactor media-text layout styles

* Update media-text alignment styles to support nested media-text blocks

* Update media-text layout for mobile view

Co-authored-by: amitraj2203 <amitraj2203@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
  • Loading branch information
4 people authored and ellatrix committed Jun 11, 2024
1 parent b89fb7b commit 531944b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/block-library/src/media-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,36 @@
}

.wp-block-media-text.is-vertically-aligned-top {
.wp-block-media-text__content,
.wp-block-media-text__media {
> .wp-block-media-text__content,
> .wp-block-media-text__media {
align-self: start;
}
}

.wp-block-media-text,
.wp-block-media-text.is-vertically-aligned-center {
.wp-block-media-text__content,
.wp-block-media-text__media {
> .wp-block-media-text__content,
> .wp-block-media-text__media {
align-self: center;
}
}

.wp-block-media-text.is-vertically-aligned-bottom {
.wp-block-media-text__content,
.wp-block-media-text__media {
> .wp-block-media-text__content,
> .wp-block-media-text__media {
align-self: end;
}
}

.wp-block-media-text .wp-block-media-text__media {
.wp-block-media-text > .wp-block-media-text__media {
/*!rtl:begin:ignore*/
grid-column: 1;
grid-row: 1;
/*!rtl:end:ignore*/
margin: 0;
}

.wp-block-media-text .wp-block-media-text__content {
.wp-block-media-text > .wp-block-media-text__content {
direction: ltr;
/*!rtl:begin:ignore*/
grid-column: 2;
Expand All @@ -53,14 +54,14 @@
word-break: break-word;
}

.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media {
.wp-block-media-text.has-media-on-the-right > .wp-block-media-text__media {
/*!rtl:begin:ignore*/
grid-column: 2;
grid-row: 1;
/*!rtl:end:ignore*/
}

.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content {
.wp-block-media-text.has-media-on-the-right > .wp-block-media-text__content {
/*!rtl:begin:ignore*/
grid-column: 1;
grid-row: 1;
Expand Down Expand Up @@ -107,11 +108,11 @@
@media (max-width: #{ ($break-small) }) {
.wp-block-media-text.is-stacked-on-mobile {
grid-template-columns: 100% !important;
.wp-block-media-text__media {
> .wp-block-media-text__media {
grid-column: 1;
grid-row: 1;
}
.wp-block-media-text__content {
> .wp-block-media-text__content {
grid-column: 1;
grid-row: 2;
}
Expand Down

0 comments on commit 531944b

Please sign in to comment.