-1

I am not sure how to describe it - I want to make comments looking like facebook ones: enter image description here

But I am not sure how to align text like this - any suggestions?

Jakub Kopyś
  • 670
  • 8
  • 20

3 Answers3

2

You can use vertical-align: top to make the text aligned at the top with the image.

jsFiddle

HTML:

<img src="image.png">
<div class="text">Whatever text you want here.</div>

CSS:

.text {
  display: inline-block;
  vertical-align: top;
  width: 300px;
}
LawrenceWebDev
  • 439
  • 2
  • 7
1

Vertically align text next to an image? This is how you align text next to an image

<div>
<img style="vertical-align:middle" src="<imageUrl>">
<span style="">Your text</span>
</div>
Community
  • 1
  • 1
Ali
  • 633
  • 1
  • 9
  • 20
1

You can do it like this:

div{width: 200px;}
img{vertical-align: top;}
img, div{display: inline-block}

See fiddle https://jsfiddle.net/cvnrwo13/2/

Adam Buchanan Smith
  • 9,422
  • 5
  • 19
  • 39