美文网首页
如何让2个div并排显示

如何让2个div并排显示

作者: Arnold_Z | 来源:发表于2016-11-07 13:19 被阅读11次

1、使用display的inline属性

<div style="width:300px; height:auto; display:inline; background:yellow">AAAA</div>
<div style="width:300px; height:auto; display:inline; background:red">BBBB</div>
效果图

2、使用float

<div style="width:300px; height:auto; float:left; background:yellow">AAAA</div>
<div style="width:300px; height:auto; float:left; background:red">BBBB</div>
效果图

相关文章

网友评论

      本文标题:如何让2个div并排显示

      本文链接:https://www.haomeiwen.com/subject/ovxouttx.html