shu shu -5 years ago 180
HTML Question

float property for inline element

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!

Answer Source

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download