Place text next to image

Asked

Viewed 122,074 times

2

inserir a descrição da imagem aqui

I’m trying to put an image and a text on the side, but I’m not getting it. The text is under the photo or I can put the first sentence of the text on the same level as the top of the image on the left.

I tried to use the display:block, to a certain extent it works, because it’s on the side of the image, but it looks like a column.

Does not look like the image above, with the text under the photo.

<div>

   <img width="186" height="186" />
   Lorem Ipsum é simplesmente uma simulação de texto da indústria tipográfica e de impressos, e vem sendo utilizado desde o século XVI, quando um impressor desconhecido pegou uma bandeja de tipos e os embaralhou para fazer um livro de modelos de tipos. Lorem Ipsum sobreviveu não só a cinco séculos, como também ao salto para a editoração eletrônica, permanecendo essencialmente inalterado. Se popularizou na década de 60, quando a Letraset lançou decalques contendo passagens de Lorem Ipsum, e mais recentemente quando passou a ser integrado a softwares de editoração eletrônica como Aldus PageMaker.

</div>

My structure is the same as the one above. The image has 186px wide.

No CSS, only HTML I thought worked.

Example:

http://jsfiddle.net/9r3d8hs2/

3 answers

8


See if that’s what you want:

<table>
  <tr>
    <td><img  width="300" height="150" src='http://i.stack.imgur.com/dioLI.png'/></td>
    
    <td> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </br>
Phasellus bibendum aliquet erat, ut ornare purus malesuada et.</td> 
  </tr>
 
</table>

  • That’s right. But no table, for God’s sake. Rsrs. But I think I’ve got it here...

7

You must place the image inside a <p>/<div> and use an element align on the tag <img>.

Would look like this:

<div>
   <img align="left">
   Lorem Ipsum
</div>
  • If you want, you can trade left for right, Middle, top or bottom. More than that, just for CSS

  • And how do I give space in the text ? Why is it stuck. http://jsfiddle.net/9r3d8hs2/

  • 2

    A remark: align is not supported in HTML5, if using a previous version is ok.

  • Sets a margin-right and margin-bottom for img in CSS that solves

  • Or add with style element, if only for an image

  • Well remembered @Renan, if it’s HTML5 only with position

  • -1, Do not use, as described by @Renan, align is not supported in HTML5 and in the not too distant future there may no longer be support for the attribute.

  • @Dorivalzanetto but the answer is not wrong, it will depend on the type of document that the AP is developing. If not HTML5, you have no problem using align.

Show 3 more comments

7

I did it, I did it that way.

I put this property in the image and it worked.

img.face{
    float: left;
    border: transparent thin solid;
    padding: 5px;
    margin: 0px 10px 10px 0;
    max-width: 186px;
}
  • Actually gave me an ugly blank... this is very basic.

Browser other questions tagged

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