How to align a div with inline-block display?

Asked

Viewed 1,360 times

0

I have a news feed that consists of two Divs inline-block.

- The first contains the headline and image of the news (left).
- The other the content of the news (right).

I wish that even the paragraphs of the news content vary from news to news, which aligns itself to the center of the div left-wing.

Something like that: inserir a descrição da imagem aqui

How can I get this result ? (sorry for the photoshop Skillz Mad)

1 answer

0


Hello,

you can place them aligned side by side using float. Then the width will be respected, and no matter how much text you put in the right div.

Follow an example of code:

    <div class="div-esquerda">
       img and titulo
    </div>

    <div class="div-direita">
       linhas e linhas de conteudo
    </div>

    <style type="text/css">
       .div-esquerda {
          width: 40%;
          float: left;
       }

       .div-direita {
              text-align: center;
              float: right;
              width: 55%;
       }

Browser other questions tagged

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