31

What is the differences between Float vs Display:inline? by default everything goes to left side in every browser. then 2 display inlined elements should be worked same like float:left.

http://www.w3schools.com/css/tryit.asp?filename=trycss_display_inline

Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852

8 Answers8

13

display:inline means a element is will "stack" next to other items, like images, spans or the bold tag. This is opposed by block level elements (display:block) which take up horizontal space, imply a line break, and will not sit next to one another, like divs, paragraphs, or tables.

Think of it this way...

<img /><img /><img />

<div />
<div />
<div />

float is a different notion altogether, moving content either left or right. By default, a floated element is inline, and floated elements will stack up next to one another.

All of these types of elements are part of the normal document flow, meaning they take up "space" in the design that cannot be shared.

Frank DeRosa
  • 2,271
  • 2
  • 14
  • 12
  • That may depend on how wide the divs are. Most inline elements will stack up next to one another, "in a line", if you will. – Frank DeRosa Nov 10 '09 at 04:22
  • 1
    This is not correct, a floated element will be automatically `display: block` – Daan Oct 12 '15 at 06:26