So I have the following CSS definitions:
.earnedhead,
.spenthead,
.remainhead,
.expendhead,
.costhead {
width: 100px;
display: inline-block;
padding: 3px 10px;
text-align: center;
margin-right: 2px;
margin-bottom: 2px;
background-color: red;
}
.spent,
.remain,
.earned {
width: 100px;
height: 28px;
display: inline-block;
padding: 3px 10px;
text-align: center;
margin-right: 2px;
background-color: blue;
}
.spent span,
.remain span {
margin-left: 0px;
}
.expendhead
{
width: 190px;
}
.costhead {
width: 0px;
}
(background color mostly for screenshot purposes. costhead’s width was in-progress)
Coupled with the HTML:
<div class='row'>
<p class='headertext'>Experience</p>
<div class='earnedhead'>Earned</div><div class='spenthead'>Spent</div><div class='remainhead'>Remaining</div><br>
<div class='earned'><input type='number' min=0 value=0 name='earned_xp' style='width:45.5px;height:28px'></div>
<div class='spent' ><span class='spanfield' name='spent_xp'>3</span></div>
<div class='remain'><span class='spanfield' name='remaining_xp'>-3</span></div>
</div>
<div class='2colrow'>
<div class='col'>
<br><br>
<div class='expendhead'>Expenditure Name</div>
<div class='costhead'>Cost</div>
(Style on the input comes form elsewhere in the CSS, added inline for reproduction purpose)
For the purposes of the below screenshot, ‘row’,‘headertext’,‘2colrow’, and ‘col’ have no definition.
What i end up with is…
the first row looks fine.
the blue row, all of the boxes are the same size (120x34) why do the second and third boxes magically drift down extra pixels, and then margin themselves too wide?
the second red row, again the margin between boxes has increased for no apparent reason? Chrome tells me both boxes have just a 2px right margin, and no other, but the gap between them is certainly more than that, and it wont even let me override the margin inline to go negative in the second box to move it back. To make the second row ‘look’ correct, I have to give an inline margin-right to the first box of -2px…what??
(PS: “Use a table” is not a valid answer to this thread.)