I am facing a challenge with multiple boxes (div
) of varying sizes. Below is a screenshot illustrating the issue:
Here's my code:
HTML
<div id="categories_container">
<div class="main_category">
<div class="categories_title"><a href="#"> <img src="template/images/image.png" alt="" /><h2> Title </h2></a>
<div style="clear:both;"></div>
</div>
<ul>
<li> <a href="#" title=""> item </a>
</li>
</ul>
</div>
</div>
CSS
div#center_container {}
div#categories_container {width:65%; margin:5px; float:left;}
div.main_category {width:197px; float:right; margin:0 10px 10px 0;}
div.categories_title img {float:right; margin-left:5px}
div.categories_title h2{float:right; font-size:20px;}
div.main_category ul {list-style-type:none; margin:0; padding:0}
div.main_category ul li {margin: 0 0 .2em 0;}
div.main_category ul li a{color:#6E6B64; font:normal 18px tahoma; display:block; background-color:#f4f4f4; padding: .2em .3em;}
div.main_category ul li a:hover {color:#F37020; background-color:#e7e7e7;}
I aim to eliminate any space between the boxes regardless of their individual sizes.