1

Can we apply float property to inline element? if we could, is there any difference between a floated inline-box and a floated block-box, like this two elements:

<span style="float: left;">hello</span>
<span style="float: left; display: block;">hello</span>

thank you!

shu
  • 115
  • 1
  • 9

1 Answers1

1

In accordance with CSS rules, when you apply float to an element, in most cases it becomes a block element. Elements that are inline and inline-block will compute to block.

From MDN:

enter image description here

References:

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
  • @Leothelion, I posted my answer. Later, somebody posted a comment suggesting a possible duplicate. The suggestion was valid, so I marked this question as a dupe. The comment was deleted. In short, I was unaware of the dupe when I posted my answer. – Michael Benjamin Aug 02 '16 at 11:44
  • oh..ok. no problem :) – Leo the lion Aug 02 '16 at 12:11