.test,
.test2 {
  display: inline-block;
}

<div class="container">
  <div class="row">

    <div class="test">
      <button type="button" class="btn btn-success">Success</button></div>

    <div class="test2">
      <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta odit omnis maiores quis, tempore ut dolorum iure, nesciunt dolores laboriosam cumque praesentium blanditiis porro repellat numquam. Ducimus, dolores atque accusantium!
      </span>
    </div>

  </div>
</div>

http://jsfiddle.net/x1hphsvb/6270/
我有两个沙发,我想把它们放在一起。

最佳答案

为此,将display: flex;添加到.row
http://jsfiddle.net/x1hphsvb/6277/

.test, .test2 {
  display: inline-block;
}
.row {display: flex;}

<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
 <div class="row">

<div class="test">
<button type="button" class="btn btn-success">Success</button></div>

<div class="test2">
   <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta odit omnis maiores quis, tempore ut dolorum iure, nesciunt dolores laboriosam cumque praesentium blanditiis porro repellat numquam. Ducimus, dolores atque accusantium!
  </span>
</div>

</div>
</div>

了解有关显示属性的更多信息-
https://www.w3schools.com/cssref/pr_class_display.asp

07-24 09:47
查看更多