I need help creating a website section with 3 containers aligned horizontally and a footer.
The containers are labeled with the class "box" and the footer is simply referred to as <footer>
. The containers are nested within a section with the id "boxes".
After applying the property float: left; to the class "box", I noticed that the entire section with the id "boxes" disappears. However, the contents of the "box" class within the "boxes" section are still visible, but the <footer>
seems to take over the entire region instead of just the "boxes" section.
Please refer to the image below for better understanding:
https://i.sstatic.net/5khY6.png
I would appreciate any advice on whether this behavior is normal and how I can achieve the desired style:
- 3 Containers aligned horizontally
- Footer at the bottom
Thank you!
P.S.: Below is a snippet showcasing the issue faced. Note how the <footer>
seems to overpower the
<section id="boxes">
.
#boxes .box {
text-align: center;
float: left;
margin-top: 20px;
width: 30%;
padding: 10px;
}
#boxes .box img {
width: 90px;
}
footer {
float: center;
text-align: center;
padding: 20px;
color: white;
background: orangered;
}
<section id="boxes">
<div class="box">
<h1>SMRT Logo</h1>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQHXhQgQJ6ky3JXZj-rCKJHjPXUJ6yynBkopg&usqp=CAU">
</div>
<div class="box">
<h1>Pimentos Del Pardon</h1>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQHXhQgQJ6ky3JXZj-rCKJHjPXUJ6yynBkopg&usqp=CAU">
</div>
<div class="box">
<h1>Tomato Plant</h1>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQHXhQgQJ6ky3JXZj-rCKJHjPXUJ6yynBkopg&usqp=CAU">
</div>
</section>
<footer>
This is the fourth project &cc 2021
</footer>