I show label, inputand divthe elements inline, expecting that they will be aligned vertically, which runs first.
However, when I try to allow the content to divoverflow with the ellipsis, they no longer align vertically
Note: This was noted in Chrome 46.02490.86
p {color:red;}
input,
label,
div {
width: 50px;
display: inline-block;
margin-left: 5px;
}
label {
text-align: right;
}
.longdesc {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
<label>Name:</label>
<input type='text' value='James'>
<label>Desc:</label>
<div>Short</div>
<hr />
<label>Name:</label>
<input type='text' value='James'>
<label>Desc:</label>
<div class='longdesc'>Longer Description</div>
<p>
In the second example "Long" is higher up
</p>
Run codeHide resultHow can I achieve an overflow effect without spoiling the vertical alignment?
source
share