I have made 3 div in following codes. 1st one has navigation element, 2 other has section element.
If you run the above code you will see border of nav and both sections. My doubt is that the border of 1st section left element should be to the right of navigation bar border. But since it is not there(can be seen by running the code), this implies div "a" and "b" are overlapping. Am I thinking in the right way?And if I am right, why CSS is designed this way of overlapping div.
In fact this contradicts the reason of introducing div in CSS.
nav {
float: left;
width: 200px;
border: 1px solid black;
}
section {
border: 3px solid red;
}
<div class="a">
<nav>
<span>nav</span>
<ul>
<li><a target="_blank" href="/default.asp">Home</a>
</li>
<li><a target="_blank" href="default.asp">CSS</a>
</li>
<li><a target="_blank" href="/html/default.asp">HTML</a>
</li>
<li><a target="_blank" href="/js/default.asp">JavaScript</a>
</li>
</ul>
</nav>
</div>
<div class="b">
<section>
<span>section</span>
<p>Notice we have put a clearfix on the div container. It is not needed in this example, but it would be if the nav element was longer than the non-floated section content.</p>
</section>
</div>
<div class="c">
<section>
<span>section</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce
luctus vestibulum augue ut aliquet.</p>
</section>
</div>