I've split my page into two vertical divs, each containing a number of nested divs wrapped so that they resize preserving a set ratio. That works great - but for some reason the divs on the left end up shorter than the divs on the right! The CSS is consistant, but something's not...
You can see a gap appear at the foot of the left-hand column here:
Is it clear what's wrong? Thank you for looking!
<head>
<style type="text/css">
.break {
padding-top: 25px;
}
.leftcol {
width: 50%;
position: absolute;
top: 0px;
left: 25px;
}
.leftpad {
padding-right: 38px;
}
.rightcol {
width: 50%;
position: absolute;
top: 0px;
right: 25px;
}
.rightpad {
padding-left: 37px;
}
.wrapper {
width: 100%;
display: inline-block;
position: relative;
}
.wrapper:after {
padding-top: 161.3%;
display: block;
background-color: red;
content: '';
}
</style>
</head>
<body>
<div class="leftcol">
<div class="leftpad">
<div class="break"></div>
<div class="wrapper"></div>
<div class="break"></div>
<div class="wrapper"></div>
<div class="break"></div>
<div class="wrapper"></div>
</div>
</div>
<div class="rightcol">
<div class="rightpad">
<div class="break"></div>
<div class="wrapper"></div>
<div class="break"></div>
<div class="wrapper"></div>
<div class="break"></div>
<div class="wrapper"></div>
</div>
</div>
</body>
</html>
I've tried zeroing margins as suggested below but that doesn't improve things. It seems like the problem could lie with the padding-top: 161.3%;
property. Changing %
to px
fixes that creeping misalignment - but I need to keep it as a percentage! Can anybody figure this out? Thanks for your time.