I
I
It2021-07-27 21:48:09
css
It, 2021-07-27 21:48:09

How to stretch an empty block to the height of an adjacent filled with content?

Actually - here is a sandbox with an example
. There are two blocks, one is empty, it has a picture / color on the background, the second is next to the content, how to make the empty block stretch by the size of the block with the content? Wrapped block in a container with display: flex

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Froggyweb, 2021-07-27
@IT_Highlander

remove the empty block height: 100%;
and instead of width 30% it's better to use flex: 0 0 30% or whatever

E
Egor Danchenko, 2021-07-27
@YahorDanchanka

.wrap {
  /* Не обязательно задавать, так как значение по умолчанию */
  align-items: stretch;
}

/* Убрать height: 100% */
.left {
  flex-shrink: 1;
  width: 30%;
  background-color: green;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question