I have run into a problem. On my current project, I have two sections next to each other, both set to cover 50% of the width of the page, using the float: left and float: right. However, when I try to add yet another section to continue on with the page, I am struck with it not appearing properly, and Firefox's inspect element shows most of it behind the two previous sections.
HTML:
<section id="first-half">
<div class="container">
<a href="#" class="content-page">
<div class="selectoption">
<img src="image.png">
</div>
</a>
</div>
</section>
<section id="second-half">
<div class="container">
<a href="#" class="content-two-page">
<div class="optionselect-two">
<img src="image_2.png">
</div>
</a>
</div>
</section>
CSS:
#first-half {
width: 50%;
height: 100%;
background-image: url('image.png');
overflow: hidden;
float: left;
}
#second-half {
width: 50%;
height: 100%;
background-image: url('image.png');
overflow: hidden;
float: right
}
Thank you for any potentional replies.
Edit: To quote the very kind kukkuz in the comment section:
"the new element is below the previous two as you have not cleared float - you must always clear floating containers - see an example here"
Thanks to everyone for their help