The blue block can use different heights, it may also not be in the document. Under the blue block, the news block…
Without changing the html document. Is it possible, using styles, to make the blue block be the height of its content, and the news be pressed against the blue block or be at the level of the red one, in case the blue block is not in the html
div {
font-size: 20px;
font-weight: bold;
}
.gl {
display: grid;
grid-template-columns: 500px 200px;
gap: 20px;
}
.b_1 {
aspect-ratio: 1;
background: red;
}
.b_2 {
background: blue;
}
.Content {
background: #0caa27;
padding: 10px;
}
<div class='gl'>
<div class='b_1'>Blok_1</div>
<div class='b_2'>Blok_2</div>
<div class='Content'>Content</div>
<div class='News'>News</div>
</div>
2
Answers
No, it’s not possible. To achieve your desired layout, your HTML requires a flex wrapper to combine
.b_2
and.news
. I have called this wrapper.sidebar
.A snippet to demonstrate:
A bit hacky but doable