Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put image and span tag in the same div to display their content on the same line

Tags:

html

css

I have following code

  <div class="expense"><img class="money"/><span class="total"></span></div>

This produces the div and puts the image on one line and the content in span tag on other line. How can I put those on the same line?

like image 235
Bhushan Firake Avatar asked Dec 09 '12 07:12

Bhushan Firake


2 Answers

css: display: inline-block or display: inline

like image 75
Ryan Avatar answered Nov 15 '22 00:11

Ryan


You could also do:

<div class="expense" style="display:table-row">
    <img class="money" style="display:table-cell" />
    <span class="total" style="display:table-cell"></span>
</div>

It's not the neatest, but it's another option

like image 25
theZenPebble Avatar answered Nov 14 '22 23:11

theZenPebble