Skip to content

Instantly share code, notes, and snippets.

@otakupahp
Last active January 9, 2023 19:54
Show Gist options
  • Save otakupahp/e7c5e0f4cd18d63e487a6fd91d2bf033 to your computer and use it in GitHub Desktop.
Save otakupahp/e7c5e0f4cd18d63e487a6fd91d2bf033 to your computer and use it in GitHub Desktop.
Add a class and use the direct parent as part of the child selector
// Desired output
// .content-section-about_this .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content
.content-section-gift,
.content-section-about_this {
.wp-block-media-text {
$selector: nth(&,1);
$direct-parent: nth($selector, length($selector));
&.is-stacked-on-mobile #{selector-append($direct-parent, '__content')} {
color: yellow;
}
}
}
.content-section-about_this .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content {
color: yellow;
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment