我有一个
,其权重为:100%,并且应该在右侧放置一个按钮。但是我的代码不起作用。
谁能帮我找出原因?
<div style="width:100%">
<span>some text</span>
<input style="position:relative; right:0px;" type="button"/>
</div>
最佳答案
Div 必须是相对的,按钮是绝对的。
<div style="width:100%; position: relative;">
<span>some text</span>
<input style="position:absolute; right: 0px;" type="button"/>
</div>
关于css - 如何使用位置 css 放置这个正确的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58336772/