Reputation: 13594
Following is the screenshot :
.
As you can see that one <div>
is overlapping the other <div>
. Why is this happening ? Following is the HTML Code snippet for the page :
<div class="rightDiv">
<div class="mainCatDiv">
@foreach (var cat in Model.SubCategories)
{
<div class="catDiv">
<h2>@Html.ActionLink(cat.CategoryName, "Catalog", "Browse", new { id = cat.CategoryName }, null)</h2>
</div>
}
</div>
<div class="productCat">
</div>
</div>
And this is the CSS code for these <div>'s
div.rightDiv { float:right; width:750px; }
div.mainCatDiv { width:100%; padding:0px 0 0 70px; }
div.catDiv { float:left; width:320px; min-height:50px; padding-left:30px; }
div.productCat { background-color:#333; height:33px; width:100%; }
Upvotes: 2
Views: 115
Reputation: 7273
From what I can see, div.catDiv
is too wide, I set it to 200px
, and that seemed to fix it. I don't know if that is too wide or narrow, but you can play with that till it fits your needs.
css
div.rightDiv { float:right; width:750px; }
div.mainCatDiv { width:100%; padding:0px 0 0 70px; }
div.catDiv { float:left; width:200px; min-height:50px; padding-left:30px; }
div.productCat { background-color:#333; height:33px; width:100%; }
a{ color: green;}
html
<div<div class="rightDiv">
<div class="mainCatDiv">
<div class="catDiv">
<h2><a href="#">Catalog 1</a></h2>
</div>
<div class="catDiv">
<h2><a href="#">Catalog 2</a></h2>
</div>
<div class="catDiv">
<h2><a href="#">Catalog 3</a></h2>
</div>
</div>
<div class="productCat">
</div>
</div>
Upvotes: 1
Reputation: 6331
The easiest solution would probably be to modify your productCat div to include a clear:left, like this:
div.productCat { clear:left; background-color:#333; height:33px; width:100%; }
This will force your product div below your category divs.
Edit: Looks like someone else posted the same answer while I was typing. Best of luck!
Upvotes: 1