1

.d1 {
  height: 10px;
}

.dd {
  display: inline-block;
  overflow: hidden;
}

.dd1 {
  display: inline-block;
}
<div class="d1">
  <div class="dd"></div>
  <div class="dd1"></div>
</div>

unset the overflow the dd and dd1 is in same line. but if set the two divs not has an equal height.

Penny Liu
  • 15,447
  • 5
  • 79
  • 98

2 Answers2

0

If you take a look at the spec, you may read:

The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes or if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge.

So what we know as the "baseline" is actually different for inline elements that have an overflow that is something other than visible.

To have them to visually appear inline, I believe you'll need to explicitely style the vertical-align property:

.d1{
    height:10px;
}
.dd{
    display:inline-block;
    vertical-align: bottom;
    overflow:hidden;
}
.dd1{
    display:inline-block;
    vertical-align: bottom;
}
George
  • 36,413
  • 9
  • 66
  • 103
0

Try this

.d1 {
  display: flex;
  align-items: center;
}

.dd {
  overflow: hidden;
}