I've been delving into the concept of float and decided to create a two-column layout using CSS:
* {
box-sizing: border-box;
}
p {
float: left;
background: pink;
}
#p1 {
width: 50%;
clear: right;
}
#p2 {
width: 50%;
}
<p id="p1">Paragraph 1.</p>
<p id="p2">Paragraph 2.</p>
Even though I set #p1 to clear:right, my expectation was that the text in #p2 would appear below it. This is because, from what I understand, clear:right should prevent any other elements from floating on the right side of #p1.
The surprising part is that setting #p2 to float:right yields no change in the document display. It remains identical to before.
I'm having difficulty comprehending why the text in #p2 doesn't shift outside the area of #p1. Can someone provide an explanation, please?