I don´t manage to get a responsive result keeping the same HTML layout.
I need :
- two different block orders if the screen width is before or after 1024px,
- => 1024px, I have to display items organized in two columns and make sure blocks 1, 2, 3 are inside the left column and blocks 4, 5 are inside the right column (the height of the wrapper has to fit of the content ),
- < 1024px, all blocks are inside unique column but the order is different.
Like this...
1024px and more
1023px and less
Current CSS
@media screen and (max-width: 1023px) {
.production-container{
display: grid;
grid-template-columns: repeat(1, 1fr);
padding: 0 var(--standard-margin) 0 var(--standard-margin);
justify-content: stretch;
min-height: 200px;
}
aside.production-block{
max-width: 100vw;
width: 100%;
display: flex;
flex: 1;
flex-direction: column;
margin: 24px 0;
display: grid;
grid-template-rows: 1fr auto;
break-inside: avoid;
}
.production-container > .production-block-4 {
order: 1;
}
.production-container > .production-block-1 {
order: 2;
}
.production-container > .production-block-2 {
order: 3;
}
.production-container > .production-block-5 {
order: 4;
}
.production-container > .production-block-3 {
order: 5;
}
}
@media screen and (min-width: 1024px) {
.production-container{
column-count: 2;
column-gap: 50px;
max-width: 1024px;
background: linear-gradient( var(--text-light-color), var(--text-light-color) ) no-repeat center/1px 100%; /* vertical line in the center */
}
.production-block {
margin: 0 0 10px 0;
break-inside: avoid;
max-width: 520px;
}
}
The most important problem is, in the biggest resolution, I don´t manage to force each block to be on the first or second column, they place thereself naturally based on height content. Maybe, I should change of css strategy compatible with the smallest resolution but when I used "grid", each row got a height that made big blank spaces.
Someone has got an idea ?

