I am currently working on a footer section
that consists of 4 div
elements, each with a shared class. Oddly enough, the first div
is extending its width more than expected. The other 3 div
elements are adjusting their width based on the content within them. Why is this discrepancy happening with the first div
? I understand that I can manually adjust the dimensions of that div
, but I am curious about the underlying reason for this behavior.
https://i.sstatic.net/CByE7.png
Additionally, I have set align-items: flex-start
for all the div
elements, but it appears to only be applying to the first one.
Here is my HTML and CSS Code:
#footer{
background-color: #1a1a1a;
height:60vh;
display: flex;
align-items: center;
justify-content: center;
}
#footer .container{
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
margin-right: 2rem;
}
.contact-handle img{
width: 20%;
}
#footer h4{
color: white;
font-weight: 500;
font-size: 18px;
}
#footer p{
color: grey;
font-size: 1rem;
margin:0;
margin-bottom: 1rem;
}
#footer i{
color: grey;
margin-right: 1rem;
}
<section id="footer">
<div class="contact-handle container">
<img src="images/logo.png" alt="">
<h4>Contact</h4>
<p>Address: XXX ABCDE Road, Street 32, Mumbai</p>
<p>Phone: (+91) 01234 56789/(+01) 2222 365</p>
<p>Hours: 10:00 - 18:00, Mon - Sat</p>
<br>
<h4>Follow Us</h4>
<div class="social_media">
<i class="fa-brands fa-facebook-f"></i>
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-instagram"></i>
<i class="fa-brands fa-youtube"></i>
</div>
</div>
<div class="About container">
<h4>About</h4>
<br>
<p>About Us</p>
<p>Delivery Information</p>
<p>Privacy Policy</p>
<p>Terms & Conditions</p>
<p>Conatct Us</p>
</div>
<div class="Account container">
<h4>My Account</h4>
<br>
<p>Sign In</p>
<p>View Cart</p>
<p>My Wishlist</p>
<p>Track Order</p>
<p>Help</p>
</div>
<div class="App_gateway container">
<h4>Install App</h4>
</div>
</section>