Skip to content

Instantly share code, notes, and snippets.

@ihorduchenko
Last active January 17, 2023 12:26
Show Gist options
  • Save ihorduchenko/eec442b3c89b0f80a65dd5574a7c7018 to your computer and use it in GitHub Desktop.
Save ihorduchenko/eec442b3c89b0f80a65dd5574a7c7018 to your computer and use it in GitHub Desktop.
Force certain column to change it's position on desktop outside of the flow
<!-- https://prnt.sc/f05LCS_YIdZq -->
<div class="product-hero">
<div class="product-media__wrapper">
Product media
</div>
<div class="product__info">
Product info
</div>
<div class="product-media__accordion">
Product accordion
</div>
</div>
<style>
@media (min-width: 1000px) {
.product-hero {
display: grid;
grid-template-columns: 1fr 1fr;
}
.product-hero .product-media__wrapper {
grid-row: 1 / auto;
grid-column: 1 / 2;
}
.product-hero .product__info {
grid-row: 1 / 20; /* Here is the trick to stretch the left columns */
grid-column: 2 / 3;
}
.product-hero .product-media__accordion {
grid-row: auto / auto;
grid-column: 1 / 2;
}
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment