<!DOCTYPE html>
<style>
span {
  border: solid 2px;
  padding: 10px;
  margin: 5px;
}
</style>
<div>
  text <span style="display: inline-block;">line1<br>line2</span>
</div>
<div>
  text <span style="display: inline-flex;">line1<br>line2</span>
</div>
