如何让按钮只浮动在div区域?
这是我的 CSS 和 HTML 示例。
.test {
width: 60%;
display: inline;
overflow: auto;
white-space: nowrap;
margin: 0px auto;
}
<div class='test'>
<div style='float: left;'>
<button>test</button>
</div>
<div style='float: right;'>
<button>test</button>
</div>
</div>
我希望它是这样的。
将 display:inline 更改为 display:inline-block
.test {
width:200px;
display:inline-block;
overflow: auto;
white-space: nowrap;
margin:0px auto;
border:1px red solid;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)