I have a very simple HTML & CSS structure that I use for practice.
Please check the fiddle link attached.
I was working on a span tag and gave it some height & width but it was not rendering.
I know the reason. span is an inline tag and it does not respect height and width properties.
But suddenly I gave it a float property and it rendered on the page.
My question is how float
property is affecting an inline element, even when it does not have any content inside.
body {
margin: 0;
padding: 0;
font-size: 10px;
line-height: 1.5em;
}
div.wrapper {
background: pink;
width: 200px;
height: 200px;
}
span.round{
width:60px;
height:60px;
background: orange;
float:right; /** not using float, vanishes the whole span **/
}
<div class="wrapper">
<span class="round"></span>
</div>