If you want to jump straightaway to working code, see here.
I'm trying to understand why the three .inline
elements below
<button class="inline">button</button>
<div class="inline parent"><div class="child">...</div></div>
<button class="inline">button</button>
...become vertically misaligned when I switch the position
property of the .child
element from relative
to absolute
1.
The other CSS settings relevant to this question are these:
.inline {
box-sizing: border-box;
width: 85px;
height: 25px;
position: relative;
}
.parent {
display: inline-block;
}
More importantly, taking all the other explicit CSS settings in the linked example, as given, how can I bring the vertically .inline.parent
element (i.e. the one with the absolutely positioned child) into alignment with the flanking ones?
EDIT: I made a small change to the code, to emphasize that all the .inline
elements have the same setting (relative
) for the position
property. I also changed linked example accordingly.
1 Note that this change does not make reference to any of the .inline
elements, but rather to a descendant of one of them.