Make the image height exactly the same as the article?

Asked

Viewed 24 times

0

I would like the height of the image to be adjusted to be identical to the article in such a way that if I add or remove some paragraph the height of the image would increase or decrease equally, something similar to the layout of the illustration below.

inserir a descrição da imagem aqui

An example of code

<div class="flex-container">
  <div class="imagem-container"></div>
  <article class="artigo-container">
    <h1>AQUI TEMOS UM TEXTO GENÉRICO</h1>
    <p>
      E aqui nós também temos outro texto genérico <br>
      E aqui nós também temos outro texto genérico <br>
      E aqui nós também temos outro texto genérico <br>
      E aqui nós também temos outro texto genérico <br>
    </p>
  </article>
</div>

1 answer

0

For that, use Flexbox

.flex-container{
  display: flex;
  align-items: center;
 }

And also, don’t leave the image height as fixed.

  • It wouldn’t work the way it needs to because the original image size is larger than the article size.

  • Edit your question and enter your css so we can know how you did it, please.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.