My nested div is causing alignment issues and I can't seem to solve it. Despite trying various solutions like margin: 0 auto
and setting a specific width, the centering problem persists. Can someone please help me identify the issue and provide a fix for it? Thank you!
<div class="services-container">
<h1 class="header-title banner">Services</h1>
<div class="service-items">
<div class="service-item">
<span class="icon-box icon"></span><h2 class="service-title">Moving</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquam laoreet nisl sed placerat. Cum sociis natoque penatibus et magnis dits mcorper semper nibh ac auctor. </p>
<a href="#">Learn More</a>
</div>
<div class="service-item">
<span class="icon-box icon"></span><h2 class="service-title">Delivery</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquam laoreet nisl sed placerat. Cum sociis natoque penatibus et magnis dits mcorper semper nibh ac auctor. </p>
<a href="#">Learn More</a>
</div>
<div class="service-item">
<span class="icon-box icon"></span><h2 class="service-title">Accounting</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquam laoreet nisl sed placerat. Cum sociis natoque penatibus et magnis dits mcorper semper nibh ac auctor. </p>
<a href="#">Learn More</a>
</div>
<div class="service-item">
<span class="icon-box icon"></span><h2 class="service-title">IT Services</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquam laoreet nisl sed placerat. Cum sociis natoque penatibus et magnis dits mcorper semper nibh ac auctor. </p>
<a href="#">Learn More</a>
</div>
</div>
</div>
CSS:
div.services-container {
margin-top: 1em;
overflow:hidden;
max-width: 100%;
margin: 0 auto;
}
div.service-items {
max-width: 1280px;
overflow:hidden;
margin: 0 auto;
}
div.service-item {
border:1px solid black;
width:45%;
padding: 1em;
margin:0 auto;
float:left;
text-align: center;
}