I have been trying to make a web site so I can test some things, in this I was trying to put the <div>
s of the container on top of the page and the rest of the content should be on the bottom of that div.
But the result that I get is the 3 <div>
s with the class="square"
on the left of the page and the rest of the content on the left of the container div.
So my question is, how can I correct the page layout?
And another question that I have is how does the float
work?
.square {
width: 100px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
background: #e3e3e3;
float: left;
margin: 40px 40px;
}
<div id="container">
<div class="square">Quadrado 1</div>
<div class="square">Quadrado 2</div>
<div class="square">Quadrado 3</div>
</div>
<div>
<p>this paragraph should be under the div with the "container" class</p>
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </h1>
<h2>Sed a porttitor nisl. Praesent a nisl nec nisi interdum efficitur a nec metus.</h2>
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </h1>
<h2>Sed a porttitor nisl. Praesent a nisl nec nisi interdum efficitur a nec metus.</h2>
</div>