原文:https://www.cnblogs.com/zouwangblog/p/11149621.html

float

<div class="div1">123</div>
<div class="div2">456</div>
<style>
.div1 {
float: left;
}
.div2 {
float: left;
}
</style>

  

inline-block

<div class="div1">123</div>
<div class="div2">456</div>
<style>
.div1 {
display: inline-block;
}
.div2 {
display: inline-block;
}
</style>

flex

这个是针对父元素设置的!!!

<div class="parent">
<div class="div1">123</div>
<div class="div2">456</div>
</div>
<style>
.parent {
display: flex;
}
</style>