尝试将提交按钮移动到页面底部

时间:2014-09-19 15:35:20

标签: javascript html css

如何将按钮移动到页面底部?我试过,它不起作用。我尝试过margin-bottom:0px;但按钮仍然没有移动到底部

 <form tag="Create Logon">
    <div id="layer">
    </div>
    <div class="left">
        Fistname *:
    </div>
    <div class="right">
        <input type="firstname" name="firstname" style="width: 300px; font-size: 14pt; margin-left: 40px;" />
    </div>
    <div class="right">
        <input type="Username" name="username" style="width: 300px; font-size: 16pt; margin-left: 40px;" />
    </div>
    <div class="left">
        Password *:
    </div>
    <div class="right">
        <input type="password" name="password" style="width: 300px; font-size: 16pt; margin-left: 40px;" />
    </div>
    <p>Note: Please make sure your details are correct before submitting form and that all fields marked with * are completed!</p>
    <button onclick="myFunction()">Submit</button>
    <script>
        function myFunction() {
            alert("Thank you for registering with GreenB!");
        }
    </script>
</div>

2 个答案:

答案 0 :(得分:2)

使用绝对定位:

button {
    position:absolute;
    bottom:0;
}

<强> jsFiddle example

答案 1 :(得分:0)

button {position: absolute; bottom: 0}