div不换行的三种方法
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>