Html 同一行有两个不同的提交按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3375790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:56:55  来源:igfitidea点击:

Two different submit buttons on the same line

htmlformsdjango-forms

提问by Ali

I have two submit buttons part of two different forms. They are being displayed on two different lines. Is it possible to have them, side by side on a single line.

我有两个不同形式的两个提交按钮的一部分。它们显示在两条不同的行上。是否可以将它们并排在一条线上。

<form action="" method="POST">
        <input type="submit" name = "" value="OK" >
                    </form> 
<form action="" method="POST">
        <input type="submit" name = "" value="Cancel" >
                    </form>

采纳答案by apolfj

<div style="width:400px;">
    <div style="float: left; width: 130px"> 
        <form id="thisone" action="post_nrs_users.asp" method="post">
            <input type="submit" name = "" value="OK" >
        </form>
    </div>
    <div style="float: right; width: 225px"> 
        <form id="thistoo" action="post_nrs_users.asp" method="post">
            <input type="submit" name = "" value="Cancel" >
        </form>
    </div>
</div>

回答by spinon

The other way is to change the css properties for the form tags:

另一种方法是更改​​表单标签的 css 属性:

form { display: inline; }

Example: http://jsbin.com/omene3/2/edit

示例:http: //jsbin.com/omene3/2/edit

回答by apolfj

Sure. Use the following CSS:

当然。使用以下 CSS:

form { float: left; }

or

或者

input { float: left; }